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

StringcapitalizePlayerName(String name)
capitalize Player Name
String capitalizedName = name.substring(0, 1).toUpperCase() + name.substring(1);
return capitalizedName;
StringcapitalizePropertyName(String propertyName)
capitalize Property Name
return propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1);
StringcapitalizePropertyName(String s)
Return a capitalized version of the specified property name.
if (s.length() == 0) {
    return s;
char[] chars = s.toCharArray();
chars[0] = Character.toUpperCase(chars[0]);
return new String(chars);
StringcapitalizeString(final String in)
capitalize String
if (in.isEmpty())
    return in;
final StringBuilder sb = new StringBuilder(in.length());
sb.append(Character.toUpperCase(in.charAt(0)));
for (int i = 1; i < in.length(); i++) {
    sb.append(Character.toLowerCase(in.charAt(i)));
return sb.toString();
...
StringcapitalizeString(String aString)
capitalize String
if (aString != null && aString.length() > 0)
    return aString.substring(0, 1).toUpperCase() + aString.substring(1);
return "";
StringcapitalizeString(String str)
capitalize String
int strLen;
if (str == null || (strLen = str.length()) == 0) {
    return str;
StringBuffer buffer = new StringBuffer(strLen);
boolean whitespace = true;
for (int i = 0; i < strLen; i++) {
    char ch = str.charAt(i);
...
StringcapitalizeString(String string)
capitalize String
char[] chars = string.toCharArray();
chars[0] = Character.toUpperCase(chars[0]);
return String.valueOf(chars);
StringcapitalizeString(String string)
Returns the string defined by parameter string capitalized (the first letter in uppercase).
if (string.length() == 0)
    return string;
String firstLetter = string.substring(0, 1);
String theRest = string.substring(1, string.length());
return firstLetter.toUpperCase() + theRest;
StringcapitalizeString(String string)
capitalize String
char[] chars = string.toLowerCase().toCharArray();
boolean found = false;
for (int i = 0; i < chars.length; i++) {
    if (!found && Character.isLetter(chars[i])) {
        chars[i] = Character.toUpperCase(chars[i]);
        found = true;
    } else if (Character.isWhitespace(chars[i]) || chars[i] == '.' || chars[i] == '\'') { 
        found = false;
...
StringcapitalizeString(String text, boolean replaceUnderscore)
Fix the given text with making the first letter captializsed and the rest not.
if (text.isEmpty()) {
    return text;
if (text.length() == 1) {
    return text.toUpperCase();
String toReturn = text.substring(0, 1).toUpperCase() + text.substring(1).toLowerCase();
if (replaceUnderscore) {
...