Here is the program of strng tokenizer example in java
import java.util.StringTokenizer;
public class MyStringTokenizer {
public static void main(String a[]){
String msg = "This,program,gives,sample";
StringTokenizer st = new StringTokenizer(msg,",", true);
System.out.println(st.countTokens());
while(st.hasMoreTokens()){
System.out.println(st.nextToken());
}
}
}
0 comments:
Post a Comment