List of utility methods to do String Capitalize First
String | capitalizeFirstLetter(String s) capitalize First Letter return s.substring(0, 1).toUpperCase() + s.substring(1);
|
String | capitalizeFirstLetter(String s) capitalize First Letter if (s.length() == 0) throw new IllegalArgumentException("Cannot capitalize first letter of empty string"); return Character.toString(Character.toUpperCase(s.charAt(0))) + s.substring(1); |
String | capitalizeFirstLetter(String str) capitalize First Letter char[] chars = str.toCharArray(); if ((chars[0] >= 97 && chars[0] <= 122)) { chars[0] -= 32; return String.valueOf(chars); |
String | capitalizeFirstLetter(String str) Capitalize the first letter in a word if (str.length() == 0) { return str; } else if (str.length() == 1) { return str.toUpperCase(); char[] string = str.toLowerCase().toCharArray(); string[0] = Character.toUpperCase(string[0]); for (int index = 0; index < string.length; index++) { ... |
String | capitalizeFirstLetter(String str) capitalizes just the first letter and returns the given string if (str == null) return null; if (str.length() == 0) return str; if (str.length() == 1) return Character.toString((Character.toUpperCase(str.charAt(0)))); else return Character.toUpperCase(str.charAt(0)) + str.substring(1); ... |
String | capitalizeFirstLetter(String str) capitalize First Letter if (str != null && str.length() == 1) { return String.valueOf(str.charAt(0)).toUpperCase(); } else if (str != null && str.length() > 1) { return String.valueOf(str.charAt(0)).toUpperCase() + str.substring(1); } else return str; |
String | capitalizeFirstLetter(String str) Makes the first letter uppercase of the given String. if (str == null || str.length() == 0) { return str; StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(Character.toTitleCase(str.charAt(0))); if (str.length() > 1) { stringBuilder.append(str.substring(1)); return stringBuilder.toString(); |
String | capitalizeFirstLetter(String str) capitalize First Letter return (isEmpty(str) || !Character.isLetter(str.charAt(0))) ? str
: Character.toUpperCase(str.charAt(0)) + str.substring(1);
|
String | capitalizeFirstLetter(String str) Returns a new string where the first letter of the specified string is capitalized. if (str.length() > 0) { return replaceCharAt(str, 0, Character.toUpperCase(str.charAt(0))); return str; |
String | capitalizeFirstLetter(String string) Given a string, returns a new String with the first letter, and only the first letter, capitalized. String lowerCaseString = string.toLowerCase();
return Character.toUpperCase(lowerCaseString.charAt(0)) + lowerCaseString.substring(1);
|