-2

Its my first question on stackoverflow please cooperate

How to read tokens one by one using a loop??? i have too many tokens in my stringtokenizer and i want to analyze them one by one using a loop(for or while any one) so please me help in this. Please tell me other better methods to analyze large number of strings

Shubham
  • 72
  • 1
  • 10
  • 2
    Post what you tried?? – Karthikeyan.R.S Jan 02 '15 at 06:17
  • you didn't searched before posting question, there is too much docs related to this question on internet for example: http://www.mkyong.com/java/java-stringtokenizer-example/ – void Jan 02 '15 at 06:19
  • i just made tokens and made a string to read token using .nexttoken() but now i dont know how to access the next one and all others – Shubham Jan 02 '15 at 06:21
  • *"Its my first question on stackoverflow please cooperate"*. Here's some free advice. In future, you should choose your words more carefully. What you have written ("please cooperate") is the kind of thing that a parent or teacher would say to an unruly child. If you want people to help you, it would be wise to be more respectful. – Stephen C Jan 02 '15 at 06:52
  • sorry stephen i ll take care of it in future thanx for advice – Shubham Jan 02 '15 at 08:11

1 Answers1

0

A quick Google search yields this code sample.

String str = "This is String , split by StringTokenizer, created by mkyong";
System.out.println("---- Split by comma ',' ------");
StringTokenizer st2 = new StringTokenizer(str, ",");

while (st2.hasMoreElements()) {
  System.out.println(st2.nextElement());
}

Source: http://www.mkyong.com/java/java-stringtokenizer-example/

mxxk
  • 9,514
  • 5
  • 38
  • 46