Returns a copy of the input string in which all plain #isLowerCase(char) lowercase ASCII characters have been converted to uppercase. All other characters are copied without modification.
(String string)
| 498 | |
| 499 | |
| 500 | public static String toUpperCase(String string) { |
| 501 | int length = string.length(); |
| 502 | for (int i = 0; i < length; i++) { |
| 503 | if (isLowerCase(string.charAt(i))) { |
| 504 | char[] chars = string.toCharArray(); |
| 505 | for (; i < length; i++) { |
| 506 | char c = chars[i]; |
| 507 | if (isLowerCase(c)) { |
| 508 | chars[i] = (char) (c & 0x5f); |
| 509 | } |
| 510 | } |
| 511 | return String.valueOf(chars); |
| 512 | } |
| 513 | } |
| 514 | return string; |
| 515 | } |
| 516 | |
| 517 | /** |
| 518 | * Returns a copy of the input character sequence in which all {@linkplain #isLowerCase(char) |
no test coverage detected