- 将首字母大写
-
String a ="i am a boy"; String[] b =a.split("\\s+"); StringBuffer sb =new StringBuffer(); for (int i=0;i<b.length;i++){ sb.append(String.valueOf(b[i].charAt(0)).toUpperCase()+b[i].substring(1)+" "); } System.out.println(sb);
时间: 2024-12-10 01:55:56