aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Doubt on string tokenizer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Doubt on string tokenizer" Watch "Doubt on string tokenizer" New topic
Author

Doubt on string tokenizer

Mythily Jaganathan
Greenhorn

Joined: Aug 22, 2006
Posts: 19
Hi All,

String message = "javax.swing.JLabel Message";

The above string should be splitted into "javax.swing.JLabel" and "Message". How to use string tokenizer so that string message splitted into 2 tokens. Please help me to solve this problem.

Thanks
Mythily
Alangudi Balaji Navaneethan
Ranch Hand

Joined: Apr 28, 2004
Posts: 42
Hi Mythili,

You can use the split method to seperate your string as you want. I herewith give you the code I tried and which worked fine.


Have a try


if you think you can you r right<br />if you think you can not you r double right
Mythily Jaganathan
Greenhorn

Joined: Aug 22, 2006
Posts: 19
Hi,

Thanks for your help, it worked!


Thanks
Mythily
Alangudi Balaji Navaneethan
Ranch Hand

Joined: Apr 28, 2004
Posts: 42
hi,

if you have clarified your doubt. then you can close the topic. So that others can help some body else.
Jinto Lonappan
Greenhorn

Joined: Mar 13, 2006
Posts: 20
I think you have asked about the StringTokenizer, if it is so please refer:

http://java.sun.com/j2se/1.4.2/docs/api/java/util/StringTokenizer.html

But it is mentioned in that page itself that it is better to use String.split()....

So you go ahead with split()....This is just for your reference....
Mythily Jaganathan
Greenhorn

Joined: Aug 22, 2006
Posts: 19
Hi Jinto,

The link you have mentioned is really useful and gone through it.
Thanks a lot. I am learning something now.

Thanks
Mythily
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doubt on string tokenizer