List of utility methods to do String Capitalize First
String | capitalizeFirstLetter(String string) This method capitalizes the first character of the string. if (string.trim().isEmpty() || (string == null)) { return string; } else { return Character.toUpperCase(string.charAt(0)) + string.substring(1); |
String | capitalizeFirstLetter(String text) capitalize First Letter String[] split = text.split(" "); String finalStr = ""; for (String s : split) { finalStr += s.substring(0, 1).toUpperCase() + s.substring(1).toLowerCase() + " "; return finalStr.substring(0, finalStr.length() - 1); |
String[] | capitalizeFirstLetter(String[] strArr) capitalize First Letter for (int j = 0; j < strArr.length; j++) { strArr[j] = capitalizeFirstLetter(strArr[j]); return strArr; |
String | capitalizeFirstOnly(String original) capitalize First Only if (original == null) { return null; } else { String modified = original.toLowerCase(); modified = Character.toUpperCase(modified.charAt(0)) + modified.substring(1, modified.length()); return modified; |
String | capitalizeFirstOnly(String s) Capitalize all letters preceded by whitespace, and lower case all other letters. if (s == null) return null; if (s.length() == 0) return s; StringBuffer sbuf = new StringBuffer(); char c = s.charAt(0); sbuf.append(Character.toUpperCase(c)); boolean space = Character.isWhitespace(c); ... |
String | capitalizeTheFirstLetter(String input) capitalize The First Letter String result; if (input.length() > 0) { result = input.substring(0, 1).toUpperCase() + input.substring(1); } else { result = input; return result; |