Meaningless Drivel is fun!*
The moose likes Beginning Java and the fly likes Retrieve delimetted value from String Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Retrieve delimetted value from String" Watch "Retrieve delimetted value from String" New topic
Author

Retrieve delimetted value from String

aakash bhatt
Ranch Hand

Joined: Jan 09, 2003
Posts: 182
In my String , I have value as String vTest = "ABC#XYZ#PQR#STV"
How do i retrieve the value ABC, XYZ each by each which is delimetted by #
Thanks,
aakash
Nigel Browne
Ranch Hand

Joined: May 15, 2001
Posts: 673
Use StringTokenizer
Jeff Allison
Greenhorn

Joined: Dec 09, 2004
Posts: 20
While StringTokenizer will work, the split method works for simple strings and delimiters like this. See <http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html#split(java.lang.String)>
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
And in JDK 5 you can try Scanner. So many ways to solve one problem!


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Retrieve delimetted value from String