Android Utililty Methods String Capitalize

List of utility methods to do String Capitalize

Description

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

Method

StringcapitalizeFirstLetter(String word)
capitalize First Letter
return word.substring(0, 1).toUpperCase() + word.substring(1);
Stringcapitalize(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);
Stringcapitalize(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);
...
Stringuncapitalize(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);
...
Stringcapitalize(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);
StringcapitalizeFirstLetter(String src)
capitalize First Letter
return src.substring(0, 1).toUpperCase() + src.substring(1);
Stringcapitalize(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);
Stringcapitalize(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));
...
StringcapitalizeFirst(String i, Locale l)
capitalize First
return i.substring(0, 1).toUpperCase(l)
        + i.substring(1).toLowerCase(l);
Stringcapitalize(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();
...