File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes StringTokenizer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "StringTokenizer" Watch "StringTokenizer" New topic


viral trivedi

Joined: Apr 24, 2003
Posts: 3
I have a string with ";" as a delimiter. Everytime i parse this string via nextTokens of a string tokenizer it fetches the next as it says. How can i get to print every token rahter than alternate?
jason adam
Chicken Farmer ()
Ranch Hand

Joined: May 08, 2001
Posts: 1932
Gonna move this guy to the Beginner's forum, since it isn't related to I/O or Streams, and would probably get answered quicker there.
jason adam
Chicken Farmer ()
Ranch Hand

Joined: May 08, 2001
Posts: 1932
Oh yeah, and welcome to the Ranch Viral!
As for your question, are you trying to print the String and the token together, so something like "data;", or do you want to print "data" then ";"?
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63839

Could we see the iteration code? (Be sure to use the UBB code tags).

[Asking smart questions] [About Bear] [Books by Bear]
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
As Jason alluded to, and perhaps what viral is looking to discover is the StringTokenizer constructor that takes three arguments. Take a look at The StringTokenizer Class Documentation.

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
I agree. Here's the link:
subject: StringTokenizer
It's not a secret anymore!