MCPcopy Create free account
hub / github.com/LFYSec/MScan / capitalize

Method capitalize

src/main/java/pascal/taie/util/Strings.java:40–52  ·  view source on GitHub ↗

Capitalizes a String, changing the first letter to upper case as per Character#toUpperCase(char). No other letters are changed. @param str the String to capitalize @return the capitalized String

(String str)

Source from the content-addressed store, hash-verified

38 * @return the capitalized {@link String}
39 */
40 public static String capitalize(String str) {
41 if (str == null || str.isEmpty()) {
42 return str;
43 }
44 char oldFirst = str.charAt(0);
45 char newFirst = Character.toUpperCase(oldFirst);
46 if (oldFirst == newFirst) {
47 return str;
48 }
49 char[] chars = str.toCharArray();
50 chars[0] = newFirst;
51 return new String(chars);
52 }
53
54}

Callers 1

makePlainSelectorMethod · 0.95

Calls 1

isEmptyMethod · 0.65

Tested by

no test coverage detected