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

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "StringTokenizer" Watch "StringTokenizer" New topic


aliya sharma
Ranch Hand

Joined: Aug 11, 2004
Posts: 48
I'm writing this simple program where StringTokenizer takes the string and gives me the result with seperator(which is , in my case). Heres the code:

but when i run my code, Im getting ballot04,expo as my output. I want to get ballot04
I thought StringTokenizer removes/ignores the seperator and gives the result??. Is there something im doing wrong???. THanks for your help

Scott Dunbar
Ranch Hand

Joined: Sep 23, 2004
Posts: 245
You need to construct your StringTokenizer with the delimeter as it defaults to the space character. Something like:

<a href="" target="_blank" rel="nofollow">Java forums using Java software</a> - Come and help get them started.
aliya sharma
Ranch Hand

Joined: Aug 11, 2004
Posts: 48
Thanks a lot Scott, it works fine now.

I agree. Here's the link:
subject: StringTokenizer
It's not a secret anymore!