List of utility methods to do String Capitalize
String | capitalize(String str) capitalize int strLen; if (str != null && (strLen = str.length()) != 0) { char firstChar = str.charAt(0); return Character.isTitleCase(firstChar) ? str : (new StringBuilder(strLen)).append(Character.toTitleCase(firstChar)).append(str.substring(1)) .toString(); } else { return str; ... |
String | capitalize(String str) Capitalize a String , changing the first letter to upper case as per Character#toUpperCase(char) . return changeFirstCharacterCase(str, true);
|
String | capitalize(String str) capitalize int strLen; if (str == null || (strLen = str.length()) == 0) { return str; return new StringBuffer(strLen).append(Character.toTitleCase(str.charAt(0))).append(str.substring(1)) .toString(); |
String | capitalize(String str) capitalize String prefix = str.substring(0, 1).toUpperCase(); String suffix = str.length() > 1 ? str.substring(1).toLowerCase() : ""; return prefix + suffix; |
String | capitalize(String str) Capitalizes a String changing the first letter to title case as per Character#toTitleCase(char) . if (str == null) { return null; StringBuilder result = new StringBuilder(str.toString()); if (result.length() > 0) { result.setCharAt(0, Character.toTitleCase(result.charAt(0))); return result.toString(); ... |
String | capitalize(String str) capitalize if (str == null || str.equals("")) return str; return str.substring(0, 1).toUpperCase() + str.substring(1); |
String | capitalize(String str) capitalize if (str.isEmpty()) return str; return str.substring(0, 1).toUpperCase() + str.substring(1).toLowerCase(); |
String | capitalize(String str) Capitalizes a String changing the first letter to title case as per Character#toTitleCase(char) . String capilizedStr = str; int len; if (str != null && (len = str.length()) > 0) { capilizedStr = new StringBuilder(len).append(Character.toTitleCase(str.charAt(0))) .append(str.substring(1)).toString(); return capilizedStr; |
String | capitalize(String str) Borrowed from commons-lang StringUtils.capitalize() method.
int strLen; if (str == null || (strLen = str.length()) == 0) { return str; return new StringBuffer(strLen).append(Character.toTitleCase(str.charAt(0))).append(str.substring(1)) .toString(); |
String | capitalize(String str) capitalize int strLen; if (str == null || (strLen = str.length()) == 0) { return str; return new StringBuilder(strLen).append(Character.toTitleCase(str.charAt(0))).append(str.substring(1)) .toString(); |