MCPcopy Create free account
hub / github.com/antlr/codebuff / toUpperCase

Method toUpperCase

output/java_guava/1.4.16/Ascii.java:461–476  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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)

Callers 4

upperCaseMethod · 0.95
convertMethod · 0.95
normalizeWordMethod · 0.95
firstCharOnlyToUpperMethod · 0.95

Calls 6

isLowerCaseMethod · 0.95
toStringMethod · 0.65
lengthMethod · 0.45
toCharArrayMethod · 0.45
valueOfMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected