It's not a secret anymore!
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
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
It's not a secret anymore!