Posted By:
Tim_Rohaly
Posted On:
Thursday, April 19, 2001 02:47 PM
StringTokenizer doesn't just use whitespace
as token delimiters - that is merely the default. To
specify your own set of delimiters, use one of the other
two
StringTokenizer constructors. The delimiters
can be only one-character each, but you can have as many
as you want. For example, to scan your input using commas
as delimiters, you would use the following line when
creating your
StringTokenizer:
StringTokenizer st = new StringTolenizer(s, ",");
For information on how to properly use
StreamTokenizer(which you probably have to do if you require multi-character
delimiters like ":=") you should use the search feature and
search the IO FAQ for "StreamTokenizer". You will find many
examples this way.