for loop to find consonants in a string

后端 未结 5 1025
灰色年华
灰色年华 2021-01-28 02:24

Using a for loop, how do I go about making all consonants in a string uppercase?

I think I should do something like this:

    String str = \"fish$\"             


        
5条回答
  •  再見小時候
    2021-01-28 02:26

    You can use Character.toUpperCase().

    String vowels = "aeiouAEIOU";
    char[] charArr = str.toCharArray(); //turn the string into char array
    for(int i=0; i

提交回复
热议问题