Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Using StringTokenizer to jump to a specific token

800467Jan 29 2009 — edited Jan 29 2009
Hi all,

I have a StringTokenizer which is splitting on ",". I want to append some text after the nth column (e.g. 2) is there a way of
going to the 2nd column directly and appending some text?

e.g.
String test = a,b,c,d,e,f,;
StringTokenizer token = new StringTokenizer(test, ",")
Now what I want to is go to token 5 (which is f) and append some text to this token. This is rather than having to do token.nextToken() 5 times,

Is this possible?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 26 2009
Added on Jan 29 2009
3 comments
454 views