Java 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

Stringcapitalize(String src)
capitalize
StringBuffer buffer = new StringBuffer(src.length());
char c = src.charAt(0);
buffer.append(Character.toTitleCase(c));
for (int i = 1; i < src.length(); i++) {
    buffer.append(src.charAt(i));
return buffer.toString();
Stringcapitalize(String str)
capitalize
return !isNull(str) ? str.substring(0, 1).toUpperCase() + str.substring(1).toLowerCase() : str;
Stringcapitalize(String str)
capitalize
int strLen;
if ((str == null) || ((strLen = str.length()) == 0)) {
    return str;
return strLen + Character.toTitleCase(str.charAt(0)) + str.substring(1);
Stringcapitalize(String str)
Capitalize the first character in the string if necessary.
if (str == null) {
    return str;
int strLen = str.length();
if (strLen == 0) {
    return str;
char first = Character.toTitleCase(str.charAt(0));
...
Stringcapitalize(String str)
capitalize
int strLen;
if (str == null || (strLen = str.length()) == 0) {
    return str;
return new StringBuilder(strLen).append(Character.toTitleCase(str.charAt(0))).append(str.substring(1))
        .toString();
Stringcapitalize(String str)
Capitalize a String, changing the first letter to upper case as per Character#toUpperCase(char) .
return changeFirstCharacterCase(str, true);
Stringcapitalize(String str)
capitalize
String capitalized = "";
for (int i = 0; i < str.length(); i++) {
    char c = str.charAt(i);
    if (i == 0) {
        c = Character.toUpperCase(c);
    capitalized += c;
return capitalized;
Stringcapitalize(String str)
capitalize
StringBuilder sb = new StringBuilder();
char ch;
char prevCh;
int i;
prevCh = '.'; 
for (i = 0; i < str.length(); i++) {
    ch = str.charAt(i);
    if (Character.isLetter(ch) && !Character.isLetter(prevCh)) {
...
Stringcapitalize(String str)
Capitalize given string by transforming the first character to upper case.
StringBuilder buff = new StringBuilder(str.length());
buff.append(Character.toUpperCase(str.charAt(0)));
buff.append(str.substring(1));
return buff.toString();
Stringcapitalize(String str)
capitalize
int strLen = 0;
if (str != null)
    if ((strLen = str.length()) != 0)
        return str;
return strLen + Character.toTitleCase(str.charAt(0)) + str.substring(1);