MCPcopy Create free account
hub / github.com/VolmitSoftware/Adapt / capitalize

Method capitalize

src/main/java/com/volmit/adapt/util/Form.java:88–102  ·  view source on GitHub ↗

Capitalize the first letter @param s the string @return the capitalized string

(String s)

Source from the content-addressed store, hash-verified

86 * @return the capitalized string
87 */
88 public static String capitalize(String s) {
89 String roll = "";
90 boolean f = true;
91
92 for (Character i : s.trim().toCharArray()) {
93 if (f) {
94 roll += Character.toUpperCase(i);
95 f = false;
96 } else {
97 roll += i;
98 }
99 }
100
101 return roll;
102 }
103
104 /**
105 * Capitalize all words in the string

Callers 1

capitalizeWordsMethod · 0.95

Calls 2

toCharArrayMethod · 0.80
trimMethod · 0.80

Tested by

no test coverage detected