Have a look at the API documentation of the String class. It contains a lot of methods that you could use to do this. Try something out yourself, it's not a difficult problem.
Originally posted by Remko Strating: The following code will do that ...
Remko, did you read the message above the JavaRanch forum overview:
"We're all here to learn, so when responding to others, please focus on helping them discover their own solutions, instead of simply providing answers."
The OP would have learned more if you'd let him figure it out for himself - that's why I didn't give him the answer to this simple question, just a hint about where to look.