String Tokenization in java using Stringtokenizer class with example

To perform tokenization in java is pretty easy.

Suppose we want to tokenize this sentence"I am going to delhi". And we want output like as follow:
I
am
going
to
delhi

The code is;

String s="I am going to delhi";
StringTokenizer st = new StringTokenizer(s);
    while (st.hasMoreTokens()) 
{
  System.out.println(st.nextToken())
 }


See also:

Comments

Popular posts from this blog

Accounting Multiple Choice Questions with answers | Download PDF for MCQs

Accounting Multiple Choice Questions with answers | Download PDF for MCQs