MCPcopy Create free account
hub / github.com/Card-Forge/forge / capitalize

Method capitalize

forge-gui/src/main/java/forge/util/WordUtil.java:9–25  ·  view source on GitHub ↗
(String str)

Source from the content-addressed store, hash-verified

7
8public class WordUtil {
9 public static String capitalize(String str) {
10 if (StringUtils.isEmpty(str)) {
11 return str;
12 }
13 final char[] buffer = str.toCharArray();
14 boolean capitalizeNext = true;
15 for (int i = 0; i < buffer.length; i++) {
16 final char ch = buffer[i];
17 if (Character.isWhitespace(ch)) {
18 capitalizeNext = true;
19 } else if (capitalizeNext) {
20 buffer[i] = Character.toTitleCase(ch);
21 capitalizeNext = false;
22 }
23 }
24 return new String(buffer);
25 }
26
27 private final static Pattern patternToWrapOn = Pattern.compile(" ");
28 public static String wordWrapAsHTML(String str) {

Callers 15

loadLightMethod · 0.95
getAllSkinsMethod · 0.95
simulateMethod · 0.95
loadLightMethod · 0.95
toUnsuppressedStringMethod · 0.45
getSharedKeywordsMethod · 0.45
hasPropertyMethod · 0.45
parseMethod · 0.45
getTitleWithoutCostMethod · 0.45

Calls 2

isWhitespaceMethod · 0.80
isEmptyMethod · 0.65

Tested by

no test coverage detected