how to tokenize a long string by using another string

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Sep 2006
Posts: 68
Reputation: rpjanaka is an unknown quantity at this point 
Solved Threads: 0
rpjanaka rpjanaka is offline Offline
Junior Poster in Training

how to tokenize a long string by using another string

 
0
  #1
Feb 7th, 2007
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



Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,273
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 378
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

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

 
0
  #2
Feb 7th, 2007
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 4,249
Reputation: peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of 
Solved Threads: 492
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

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

 
0
  #3
Feb 7th, 2007
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.
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 68
Reputation: rpjanaka is an unknown quantity at this point 
Solved Threads: 0
rpjanaka rpjanaka is offline Offline
Junior Poster in Training

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

 
0
  #4
Feb 7th, 2007
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
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for Java
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC