954,198 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

how to tokenize a long string by using another string

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

rpjanaka
Junior Poster in Training
69 posts since Sep 2006
Reputation Points: 10
Solved Threads: 0
 
iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
 

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

LOL iamthwee beaten me for faster response, good link which you provided

peter_budo
Code tags enforcer
Moderator
15,436 posts since Dec 2004
Reputation Points: 2,806
Solved Threads: 901
 

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

rpjanaka
Junior Poster in Training
69 posts since Sep 2006
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You