Review the String API for methods that can help you do what you've described.