8.1 The StringTokenizer class |
For example the following code:
String testString = "This is a,test";
StringTokenizer tokenizer = new StringTokenizer( testString," ," ); // delimiters are space and comma
while ( tokenizer.hasMoreTokens() )
{
System.out.println( tokenizer.nextToken() );
}
produces the following output:
this is a test