944,196 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 3354
  • Java RSS
Feb 7th, 2007
0

how to tokenize a long string by using another string

Expand Post »
hi

i want to break the following string..

{ok,[{operators,'sri','mob',45,45,45,45},{operators,'sri','dia',45,45,45,45}]}


by using {operators, this point..

i used the StringTokenizer class to do this by giving the
{operators, as Delimiter.

But when it runs it gives completely different result than I expected
that is it was matched any character that the delimiter include..


So please anyone can help me to do this



Similar Threads
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
rpjanaka is offline Offline
69 posts
since Sep 2006
Feb 7th, 2007
0

Re: how to tokenize a long string by using another string

Featured Poster
Reputation Points: 1536
Solved Threads: 431
Posting Expert
iamthwee is offline Offline
5,865 posts
since Aug 2005
Feb 7th, 2007
0

Re: how to tokenize a long string by using another string

Can you please provide code.... <== was my original message

LOL iamthwee beaten me for faster response, good link which you provided
Last edited by peter_budo; Feb 7th, 2007 at 3:07 pm.
Moderator
Featured Poster
Reputation Points: 2786
Solved Threads: 875
Code tags enforcer
peter_budo is offline Offline
6,659 posts
since Dec 2004
Feb 7th, 2007
0

Re: how to tokenize a long string by using another string

public void tokenize(){
StringTokenizer tokenizer = new StringTokenizer("{ok,[{operators,'sri','mob',45,45,45,45},{operators,'sri','dia',45,45,45,45}]}"
,"{operators,");
while(tokenizer.hasMoreTokens()){
System.out.println(tokenizer.nextToken());
}

}


the above is the cord
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
rpjanaka is offline Offline
69 posts
since Sep 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: urgent jdbc code
Next Thread in Java Forum Timeline: Problem using serializable coding





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC