[Javascript] Help with ECMA Scripting

FERON Matthieu FERONMA at cic-i.com
Thu Nov 15 02:13:18 CST 2001


In Javascript you can use the split method of the string object
var Inboundstr = new String( job.Inbound_Sequence.content );
var tok_array = Inboundstr.split( \'\gi , Inboundstr )
//now you'got an array build with the comma delimited parts of your initial
string
for ( i=0 ; i<tok_array.length ; i++ )
{
	// do what you want with tok_array[i]
}
I hope I well understood the question
>  -----Message d'origine-----
> De : 	Stephanie Hudson [mailto:shudson at tibco.com] 
> Envoyé :	mercredi 14 novembre 2001 22:29
> À :	javascript at LaTech.edu
> Objet :	[Javascript] Help with ECMA Scripting
> 
> Hello everyone,
> 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.  
> 
> My question is this:
> 
> 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?
> 
> Here's my script so far:
> 
> StrTok = new java.util.StringTokenizer(job.Inbound_Sequence.content, ",
> \t\n\r\f");
> while (StrTok.hasMoreElements)
> {
> writeln("Current element is " + StrTok.nextToken);
> 
> }
> 
> Thanks and regards,
> S. Hudson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20011115/8c9d5320/attachment.htm>


More information about the Javascript mailing list