Remove all vowels in a string with Java

后端 未结 5 942
不思量自难忘°
不思量自难忘° 2021-01-19 12:46

I am doing a homework assignment for my Computer Science course. The task is to get a users input, remove all of the vowels, and then print the new statement.

I kno

5条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-19 13:01

    I think you can iterate through the character check if that is vowel or not as below:

      define a new string 
      for(each character in input string)
        //("aeiou".indexOf(character) <0) id one way to check if character is consonant
        if "aeiou" doesn't contain the character  
          append the character in the new string
    

提交回复
热议问题