Change the supplied string to sentence case. @param value The value to be modified. @return The value in sentence case.
(String value)
| 208 | * @return The value in sentence case. |
| 209 | */ |
| 210 | private static String changeToTitleCase(String value) |
| 211 | { |
| 212 | String temp = value.toLowerCase(Locale.getDefault()); |
| 213 | char[] chars = temp.toCharArray(); |
| 214 | StringBuilder res = new StringBuilder(value.length()); |
| 215 | boolean start = true; |
| 216 | for (char c : chars) |
| 217 | { |
| 218 | boolean whiteSpace = Character.isWhitespace(c); |
| 219 | |
| 220 | if (start && !whiteSpace) |
| 221 | { |
| 222 | res.append(Character.toUpperCase(c)); |
| 223 | start = false; |
| 224 | } |
| 225 | else |
| 226 | { |
| 227 | start = whiteSpace; |
| 228 | res.append(c); |
| 229 | } |
| 230 | } |
| 231 | return res.toString(); |
| 232 | } |
| 233 | |
| 234 | /** |
| 235 | * Build the suffix for the provided number. |
no test coverage detected