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 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 RabbitMQ in Depth this week in the Open Source forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Retrieve delimetted value from String" Watch "Retrieve delimetted value from String" New topic

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 #
Nigel Browne
Ranch Hand

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

Joined: Dec 09, 2004
Posts: 20
While StringTokenizer will work, the split method works for simple strings and delimiters like this. See <>
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:
subject: Retrieve delimetted value from String