This week's book / license giveaways are in the JDBC and Relational Databases and Java in General forums.
We're giving away four copies each of PostGIS in Action and Java Advanced Topics Training and have the authors on-line!
See this thread and this one for details.
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
Author

StringTokenizer

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
expo
I thought StringTokenizer removes/ignores the seperator and gives the result??. Is there something im doing wrong???. THanks for your help

Aliya
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="http://forums.hotjoe.com/forums/list.page" 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.

ALiya
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: StringTokenizer