<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2650.12">
<TITLE>RE: [Javascript] Help with ECMA Scripting</TITLE>
</HEAD>
<BODY>
<P><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">In Javascript you can use the split method of the string object</FONT>
<BR><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">var Inboundstr = new String( job.Inbound_Sequence.content );</FONT>
<BR><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">var tok_array = Inboundstr.split( \'\gi , Inboundstr )</FONT>
<BR><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">//now you'got an array build with the comma delimited parts of your initial string</FONT>
<BR><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">for ( i=0 ; i<tok_array.length ; i++ )</FONT>
<BR><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">{</FONT>
<BR> <FONT COLOR="#0000FF" SIZE=2 FACE="Arial">// do what you want with tok_array[i]</FONT>
<BR><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">}</FONT>
<BR><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">I hope I well understood the question</FONT>
<UL>
<P><FONT FACE="Times New Roman"></FONT> <FONT SIZE=1 FACE="Tahoma">-----Message d'origine-----</FONT>
<BR><B><FONT SIZE=1 FACE="Tahoma">De : </FONT></B> <FONT SIZE=1 FACE="Tahoma">Stephanie Hudson [<A HREF="mailto:shudson@tibco.com">mailto:shudson@tibco.com</A>] </FONT>
<BR><B><FONT SIZE=1 FACE="Tahoma">Envoyé : </FONT></B> <FONT SIZE=1 FACE="Tahoma">mercredi 14 novembre 2001 22:29</FONT>
<BR><B><FONT SIZE=1 FACE="Tahoma">À : </FONT></B> <FONT SIZE=1 FACE="Tahoma">javascript@LaTech.edu</FONT>
<BR><B><FONT SIZE=1 FACE="Tahoma">Objet :</FONT></B> <FONT SIZE=1 FACE="Tahoma">[Javascript] Help with ECMA Scripting</FONT>
</P>
<P><FONT FACE="Times New Roman">Hello everyone,</FONT>
<BR><FONT FACE="Times New Roman">I'm new to ECMA script and am looking for some help. I'm working with the StringTokenizer method to parse a string that originated as a comma delimited file. It's entire content is held in the variable Inbound_Sequence and the content of this variable is what I'm parsing, based upon the commas and the carriage return/line feeds at the end of each row. </FONT></P>
<P><FONT FACE="Times New Roman">My question is this:</FONT>
</P>
<P><FONT FACE="Times New Roman">How can I then load into variables the string I've separated on, before moving to the next "segment" or token in the string? I know it must be simple but I don't have an ECMA script reference manual or guide. This part does what I want and separates based on the commas of the Inbound_Sequence variable's content. How do I load into a variable after each one and must I explicitly define a variable for each element?</FONT></P>
<P><FONT FACE="Times New Roman">Here's my script so far:</FONT>
</P>
<P><FONT FACE="Times New Roman">StrTok = new java.util.StringTokenizer(job.Inbound_Sequence.content, ", \t\n\r\f");</FONT>
<BR><FONT FACE="Times New Roman">while (StrTok.hasMoreElements)</FONT>
<BR><FONT FACE="Times New Roman">{</FONT>
<BR><FONT FACE="Times New Roman">writeln("Current element is " + StrTok.nextToken);</FONT>
</P>
<P><FONT FACE="Times New Roman">}</FONT>
</P>
<P><FONT FACE="Times New Roman">Thanks and regards,</FONT>
<BR><FONT FACE="Times New Roman">S. Hudson</FONT>
</P>
</UL>
</BODY>
</HTML>