Java Utililty Methods String Capitalize First

List of utility methods to do String Capitalize First

Description

The list of methods to do String Capitalize First are organized into topic(s).

Method

StringcapitaliseFirst(String string)
capitalise First
return Character.toTitleCase(string.charAt(0)) + string.substring(1, string.length());
StringcapitaliseFirstLetter(final String originalLanguageName)
Capitalises the first letter, hoping this works for all Locales.
final char codePointAt = originalLanguageName.charAt(0);
final char firstLetterTitle = Character.toTitleCase(codePointAt);
return firstLetterTitle + originalLanguageName.substring(1);
StringcapitaliseFirstLetter(String s)
capitalise First Letter
int n = s.length();
if (n == 0) {
    return "";
StringBuilder builder = new StringBuilder();
builder.append(s.substring(0, 1).toUpperCase());
if (n > 1) {
    builder.append(s.substring(1, n));
...
StringcapitaliseFirstLetter(String str)
Capitalizes first letter of given string.
return str.substring(0, 1).toUpperCase() + str.substring(1);
StringcapitaliseFirstLetter(String str)
Capitalize the first letter of a string.
if (str == null) {
    return null;
switch (str.length()) {
case 0:
    return str;
case 1:
    return str.substring(0, 1).toUpperCase();
...
StringcapitaliseFirstLetter(String text)
capitalise First Letter
if (text == null || text.length() <= 0)
    return text;
return text.substring(0, 1).toUpperCase() + text.substring(1);
StringcapitalizedFirst(String str)
capitalized First
return str.substring(0, 1).toUpperCase() + str.substring(1);
StringcapitalizedLetter(String str, boolean onlyFirst)
Capitalized first letter for each words or only first one
StringBuilder res = new StringBuilder();
char ch, prevCh;
boolean toUpper = true;
prevCh = '.';
str = str.toLowerCase();
for (int i = 0; i < str.length(); i++) {
    ch = str.charAt(i);
    if (ch == 's' && prevCh == '\'') {
...
StringcapitalizeFirst(String attribute)
capitalize First
return Character.toUpperCase(attribute.charAt(0)) + attribute.substring(1);
StringcapitalizeFirst(String input)
capitalize First
if (input == null)
    return null;
if (input.length() < 2)
    return input.toUpperCase();
return input.substring(0, 1).toUpperCase() + input.substring(1);