Instead of string tokenizer, u can also use split( ..) method of String class. For example,
public class Ram
{
public static void main(String args[])
{
String str = "JMB", strs = "JMB-JMC-ETG";
String strrs[] = strs.split("-");
for(int i=0; i<strrs.length; i++)
System.out.println(strrs[i]);
}
}
|