Check out the methods in the String API, there are a few useful functions in there.

String (Java Platform SE 6)