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)
| 459 | |
| 460 | |
| 461 | public static String toUpperCase(String string) { |
| 462 | int length = string.length(); |
| 463 | for (int i = 0; i < length; i++) { |
| 464 | if (isLowerCase(string.charAt(i))) { |
| 465 | char[] chars = string.toCharArray(); |
| 466 | for (; i < length; i++) { |
| 467 | char c = chars[i]; |
| 468 | if (isLowerCase(c)) { |
| 469 | chars[i] = (char) (c & 0x5f); |
| 470 | } |
| 471 | } |
| 472 | return String.valueOf(chars); |
| 473 | } |
| 474 | } |
| 475 | return string; |
| 476 | } |
| 477 | |
| 478 | /** |
| 479 | * Returns a copy of the input character sequence in which all {@linkplain #isLowerCase(char) |
no test coverage detected