Hi can some body help me with reversing a string i.e if the string is "this is me" it should print it as "me is this"
i trie dit by using stringtokenizer but messed it up terriblly
thank you san
Vicken Karaoghlanian
Ranch Hand
Joined: Jul 21, 2003
Posts: 522
posted
0
Try using the split("\\s") method to split the string into an array and then do a reverse loop through its elements.
You don't have to use the StringTokenizer class. [ February 03, 2005: Message edited by: Vicken Karaoghlanian ]
- Do not try and bend the spoon. That's impossible. Instead, only try to realize the truth. <br />- What truth? <br />- That there is no spoon!!!
Layne Lund
Ranch Hand
Joined: Dec 06, 2001
Posts: 3061
posted
0
Originally posted by san ch: i trie dit by using stringtokenizer but messed it up terriblly
What do you mean by this? Does the above program compile? If not, what errors do you get? If it does, what happens when you try to run it? It would help if you show us the output you get and explain how it differs from what you expect.
If you provide details like this, we will be more than happy to help you track down your problems and find solutions to them.