List of utility methods to do String Capitalize
String | capitalizeFirstLetter(String word) capitalize First Letter return word.substring(0, 1).toUpperCase() + word.substring(1);
|
String | capitalize(String s) Returns a string that is equivalent to the specified string with its first character converted to uppercase as by String#toUpperCase() . if (s.length() == 0) { return s; char first = s.charAt(0); char capitalized = Character.toUpperCase(first); return (first == capitalized) ? s : capitalized + s.substring(1); |
String | capitalize(String str) capitalize if (str == null) { return null; char[] charArray = str.toCharArray(); if (charArray.length > 0) { charArray[0] = Character.toUpperCase(charArray[0]); return new String(charArray); ... |
String | uncapitalize(String str) uncapitalize if (str == null) { return null; char[] charArray = str.toCharArray(); if (charArray.length > 0) { charArray[0] = Character.toLowerCase(charArray[0]); return new String(charArray); ... |
String | capitalize(String s) capitalize if (s == null || s.length() == 0) return s; char[] stringArray = s.toCharArray(); stringArray[0] = Character.toUpperCase(stringArray[0]); return new String(stringArray); |
String | capitalizeFirstLetter(String src) capitalize First Letter return src.substring(0, 1).toUpperCase() + src.substring(1);
|
String | capitalize(String s) Returns a string that is equivalent to the specified string with its first character converted to uppercase as by String#toUpperCase() . if (s.length() == 0) { return s; char first = s.charAt(0); char capitalized = Character.toUpperCase(first); return (first == capitalized) ? s : capitalized + s.substring(1); |
String | capitalize(String str) Capitalizes every word in str if (str == null || str.length() == 0) return str; boolean capitalizeNext = true; StringBuilder result = new StringBuilder(); for (int i = 0; i < str.length(); ++i) { char ch = str.charAt(i); if (capitalizeNext) result.append(Character.toUpperCase(ch)); ... |
String | capitalizeFirst(String i, Locale l) capitalize First return i.substring(0, 1).toUpperCase(l)
+ i.substring(1).toLowerCase(l);
|
String | capitalize(String str) capitalize StringBuilder sb = new StringBuilder(str); for (int i = 0; i < sb.length(); i++) { if (i == 0 || Character.isWhitespace(sb.charAt(i - 1))) { sb.replace(i, i + 1, Character.toString(Character .toUpperCase(sb.charAt(i)))); return sb.toString(); ... |