Convert single char in String to lower case

后端 未结 7 1744
孤独总比滥情好
孤独总比滥情好 2021-01-17 10:15

I like to \'guess\' attribute names from getter methods. So \'getSomeAttribute\' shall be converted to \'someAttribute\'.

Usually I do something like



        
7条回答
  •  醉梦人生
    2021-01-17 10:57

    Given a character buffer, you can apply the below code:

    int i = 0;
    for(char x : buffer) {
        buffer[i] = Character.toLowerCase(x);
        i++;
    }
    

    Tested and functions :)

提交回复
热议问题