• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt on string tokenizer

 
Mythily Jaganathan
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Mythily Jaganathan
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks for your help, it worked!


Thanks
Mythily
 
Alangudi Balaji Navaneethan
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

if you have clarified your doubt. then you can close the topic. So that others can help some body else.
 
Jinto Lonappan
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jinto,

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

Thanks
Mythily
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic