Capitalize the first letter @param s the string @return the capitalized string
(String s)
| 86 | * @return the capitalized string |
| 87 | */ |
| 88 | public static String capitalize(String s) { |
| 89 | String roll = ""; |
| 90 | boolean f = true; |
| 91 | |
| 92 | for (Character i : s.trim().toCharArray()) { |
| 93 | if (f) { |
| 94 | roll += Character.toUpperCase(i); |
| 95 | f = false; |
| 96 | } else { |
| 97 | roll += i; |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | return roll; |
| 102 | } |
| 103 | |
| 104 | /** |
| 105 | * Capitalize all words in the string |
no test coverage detected