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" 每个单词的首字母转换成大写其余还是小写字母
最新推荐文章于 2020-04-28 14:38:30 发布