Java examples for Language Basics:StringTokenizer
Use StringTokenizer to break string value and count tokens
import java.util.StringTokenizer; public class Main { public static void main(String[] args) { StringTokenizer st = new StringTokenizer("Java StringTokenizer count Tokens Example"); while(st.hasMoreTokens()){ System.out.println("Remaining Tokens : " + st.countTokens()); System.out.println(st.nextToken()); }//from www. j a v a 2 s . co m } }