Returns a copy of the input string in which all {@linkplain #isLowerCase(char) lowercase ASCII characters} have been converted to uppercase. All other characters are copied without modification.
(String string)
| 453 | * modification. |
| 454 | */ |
| 455 | public static String toUpperCase(String string) { |
| 456 | int length = string.length(); |
| 457 | for (int i = 0; i < length; i++) { |
| 458 | if (isLowerCase(string.charAt(i))) { |
| 459 | char[] chars = string.toCharArray(); |
| 460 | for (; i < length; i++) { |
| 461 | char c = chars[i]; |
| 462 | if (isLowerCase(c)) { |
| 463 | chars[i] = (char) (c ^ CASE_MASK); |
| 464 | } |
| 465 | } |
| 466 | return String.valueOf(chars); |
| 467 | } |
| 468 | } |
| 469 | return string; |
| 470 | } |
| 471 | |
| 472 | /** |
| 473 | * Returns a copy of the input character sequence in which all {@linkplain #isLowerCase(char) |