List of utility methods to do String Capitalize First
String | capitalizeFirstLetter(final String s) capitalize First Letter final char[] first = s.toCharArray(); if (Character.isLetter(first[0])) { first[0] = Character.toUpperCase(first[0]); return new String(first); return s; |
String | capitalizeFirstLetter(final String variableName) Returns the String passed in with the first letter capitalised. return variableName.substring(0, 1).toUpperCase() + variableName.substring(1);
|
String | capitalizeFirstLetter(String data) capitalize First Letter char firstLetter = Character.toTitleCase(data.substring(0, 1).charAt(0)); String restLetters = data.substring(1); return firstLetter + restLetters; |
String | capitalizeFirstLetter(String data) Capitalize the first letter but leave the rest as they are. String firstLetter = data.substring(0, 1).toUpperCase();
String restLetters = data.substring(1);
return firstLetter + restLetters;
|
String | capitalizeFirstLetter(String data) capitalize First Letter char firstChar = data.charAt(0); char titleCase = Character.toTitleCase(firstChar); if (firstChar == titleCase) { return data; StringBuilder result = new StringBuilder(data.length()); result.append(titleCase); result.append(data, 1, data.length()); ... |
String | capitalizeFirstLetter(String message) Capitalizes the first letter of the message and returns the result. if (message == null || message.length() == 0) { return message; char firstUpperCaseLetter = Character.toUpperCase(message.charAt(0)); String remainderOfMessage = message.substring(1); return firstUpperCaseLetter + remainderOfMessage; |
String | CapitalizeFirstLetter(String name) Capitalize First Letter if (name == null) return null; String firstLetter = name.substring(0, 1); String remainder = name.substring(1); String capitalized = firstLetter.toUpperCase() + remainder.toLowerCase(); return capitalized; |
String | capitalizeFirstLetter(String s) Capitalize first letter in string. char[] chars = s.toLowerCase().toCharArray(); for (int i = 0; i < chars.length; i++) { char ch = chars[i]; if (Character.isLetter(ch)) { chars[i] = Character.toUpperCase(ch); break; return new String(chars); |
String | capitalizeFirstLetter(String s) Capitalizes the first letter of the given String. char[] chars = s.toCharArray(); chars[0] = Character.toUpperCase(chars[0]); return new String(chars); |
String | capitalizeFirstLetter(String s) capitalize First Letter if (s == null || s.isEmpty()) return s; return s.length() == 1 ? s.toUpperCase() : s.substring(0, 1).toUpperCase() + s.substring(1); |