简体   繁体   中英

Java Character Isolation String Manipulation

I need to use the built in string methods to eliminate all but the letter characters in a string, isolating them next to each other in a mashed up single run on word, then make them lower cased. I know about the toLowerCase() method, but I'm not really sure how to do the first part. I've searched things like "Manipulating strings in Java" leading to oracle documents and other help sources that I haven't been able to track down what I'm looking for. This is how it should look with a sample input and output:

Input: "Hi, My name is Luke."

Output: "himynameisluke"

Thanks in advance with optimism.

I won't implement the code for you, But will explain the steps.

Steps are here

Try the charAt() method to find out empty space, then by using if statement you can control it to delete that empty space. As you have told, use toLowerCase() method to convert into lower case letters.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM