List of utility methods to do String Capitalize
String | capitalize(final String s) Capitalizes a string. final char[] chars = s.toCharArray(); if (chars.length > 0) { chars[0] = Character.toUpperCase(chars[0]); return new String(chars); |
String | capitalize(final String str) Capitalizes a String changing the first character to title case as per Character#toTitleCase(int) . int strLen; if (str == null || (strLen = str.length()) == 0) { return str; final int firstCodepoint = str.codePointAt(0); final int newCodePoint = Character.toTitleCase(firstCodepoint); if (firstCodepoint == newCodePoint) { return str; ... |
String | capitalize(final String str) capitalize final char firstChar = str.charAt(0); final char newChar = Character.toUpperCase(firstChar); if (firstChar == newChar) { return str; char[] newChars = new char[str.length()]; newChars[0] = newChar; str.getChars(1, str.length(), newChars, 1); ... |
String | capitalize(final String str) capitalize String result = null; if (str != null) { if (str.length() >= 2) { result = str.substring(0, 1).toUpperCase() + str.substring(1).toLowerCase(); } else { result = str.toUpperCase(); return result; |
String | capitalize(final String str) capitalize final char[] buffer = str.toLowerCase().replace('-', '_').toCharArray(); buffer[0] = Character.toTitleCase(buffer[0]); return new String(buffer); |
String | capitalize(final String str) capitalize final char charAt = str.charAt(0); return Character.toUpperCase(charAt) + str.substring(1); |
String | capitalize(final String str) Capitalizes a String changing the first letter to title case case as per Character#toUpperCase(char) . int strLen; if (str == null || (strLen = str.length()) == 0) { return str; final char firstChar = str.charAt(0); if (Character.isUpperCase(firstChar)) { return str; return new StringBuilder(strLen).append(Character.toUpperCase(firstChar)).append(str.substring(1)) .toString(); |
String | capitalize(final String str)StringUtils.capitalize(null) = null StringUtils.capitalize("") = "" StringUtils.capitalize("cat") = "Cat" StringUtils.capitalize("cAt") = "CAt" int strLen; if (str == null || (strLen = str.length()) == 0) { return str; final char firstChar = str.charAt(0); if (Character.isTitleCase(firstChar)) { return str; return new StringBuilder(strLen).append(Character.toTitleCase(firstChar)).append(str.substring(1)) .toString(); |
String | capitalize(final String str) Put first letter into uppercase if (str.length() > 1) { return str.substring(0, 1).toUpperCase() + str.substring(1); } else { return str.toUpperCase(); |
String | capitalize(final String str) StringUtils.capitalize(null) = null StringUtils.capitalize("") = "" StringUtils.capitalize("cat") = "Cat" StringUtils.capitalize("cAt") = "CAt" StringUtils.capitalize("'cat'") = "'cat'" int strLen; if (str == null || (strLen = str.length()) == 0) { return str; final char firstChar = str.charAt(0); final char newChar = Character.toTitleCase(firstChar); if (firstChar == newChar) { return str; ... |