| Author |
Use StringTokenizer
|
Grishma Dube
Ranch Hand
Joined: Jul 01, 2003
Posts: 273
|
|
I have a string id,name,status,resourceStatus,;requirement,description,owner,permission, I want to convert it into id;name;status;resourceStatus;, requirement;description;owner;permission; Can anyone tell me this, how should I do it with StringTokenizer? Thanks in Advance Grishma
|
 |
Sagar Rohankar
Ranch Hand
Joined: Feb 19, 2008
Posts: 2896
|
|
Here is what JavaDoc tells about StringTokenizer class ..
The string tokenizer class allows an application to break a string into tokens.
String#replace() , method helps !!
|
[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
|
 |
Nitesh Kant
Bartender
Joined: Feb 25, 2007
Posts: 1638
|
|
Any specific reasons to use StringTokenizer? Since JDK 5, Scanner will be a better option.
|
apigee, a better way to API!
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
Originally posted by Sagar Rohankar: String#replace() , method helps !!
Not in this case, or at least not directly. The ; and , need to be switched around. As with all swapping, you will need some temporary replacement or you will lose one of the two. replace could work as follows: Of course this will cause more problems if | is in the string.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
 |
|
|
subject: Use StringTokenizer
|
|
|