MCPcopy
hub / github.com/google/guava / toUpperCase

Method toUpperCase

guava/src/com/google/common/base/Ascii.java:455–470  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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)

Callers 15

upperCaseMethod · 0.95
convertMethod · 0.95
normalizeWordMethod · 0.95
firstCharOnlyToUpperMethod · 0.95
createMethod · 0.95
testToUpperCaseMethod · 0.95
testCharsIgnoredMethod · 0.95
testCharsLowerMethod · 0.95

Calls 5

isLowerCaseMethod · 0.95
lengthMethod · 0.45
charAtMethod · 0.45
toCharArrayMethod · 0.45
valueOfMethod · 0.45

Tested by 15

createMethod · 0.76
testToUpperCaseMethod · 0.76
testCharsIgnoredMethod · 0.76
testCharsLowerMethod · 0.76
testCharsUpperMethod · 0.76
stringToUpperCaseMethod · 0.36