1. 程式人生 > >將"goOd gooD stUdy dAy dAy up"每個單詞的首字母轉換成大寫其余還是小寫字母

將"goOd gooD stUdy dAy dAy up"每個單詞的首字母轉換成大寫其余還是小寫字母

pan private 單詞 tst clas ring out zuoye vat

public class zuoye2 {
    public static void main(String[] args) {
        String str = "goOd gooD stUdy dAy dAy up";
        str = convertStandard(str);
        System.out.println(str);
 
    }
 
    private static String convertStandard(String str) {
        String strStandard = "";
        String[] strs 
= str.split(" "); for(String s : strs){ s = s.toLowerCase(); String first = s.substring(0, 1).toUpperCase(); s = first + s.substring(1, s.length()); strStandard = strStandard + s + " "; } return strStandard; } }

將"goOd gooD stUdy dAy dAy up"每個單詞的首字母轉換成大寫其余還是小寫字母