- String a = "good good study, day day up.";
- String[] arr = a.split(" ");
- /*
- * for (String s : arr) { System.out.println(s); }
- */
- for (int i = 0; i < arr.length; i++) {
- String a1 = arr[i];
- String a2 = a1.substring(0, 1).toUpperCase()
- .concat(a1.substring(1).toLowerCase());
- System.out.print(a2 + " ");
- }
复制代码
|
|