Java Utililty Methods String Title Case

List of utility methods to do String Title Case

Description

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

Method

StringtoTitleCase(String str)
Converts the specified string to title case, by capitalizing the first letter.
if (str.length() == 0)
    return str;
else {
    return Character.toUpperCase(str.charAt(0)) + str.substring(1).toLowerCase();
StringtoTitleCase(String str)
Converts a string to title case.
if (str == null || str.length() == 0)
    return str;
final char[] chars = str.toLowerCase().toCharArray();
boolean doTitle = true;
for (int i = 0; i < chars.length; i++) {
    if (doTitle)
        chars[i] = Character.toTitleCase(chars[i]);
    doTitle = Character.isWhitespace(chars[i]);
...
StringtoTitleCase(String string)
to Title Case
return string.substring(0, 1).toUpperCase() + string.substring(1, string.length());
StringtoTitleCase(String string)
to Title Case
String result = "";
for (int i = 0; i < string.length(); i++) {
    String next = string.substring(i, i + 1);
    if (i == 0) {
        result += next.toUpperCase();
    } else {
        result += next.toLowerCase();
return result;
StringtoTitleCase(String text)
This converts a string to TitleCase (first character uppercase, the rest left alone).
return text.substring(0, 1).toUpperCase() + text.substring(1);
StringtoTitleCase(String title)
Converts words and multiple words to lowercase and Uppercase on first letter only E.g.
if (title.length() < 2)
    return title.toUpperCase();
StringBuilder sb = new StringBuilder(title.length());
boolean goUp = true;
for (int i = 0, n = title.length(); i < n; i++) {
    char c = title.charAt(i);
    if (Character.isLetterOrDigit(c) || c == '\'') {
        if (goUp) {
...
StringtoTitleCase2(String string, String separators)
Convert a strong into an alternating form of each new word starting with a capital letter.
char[] seps = separators.toCharArray();
char[] tempChar = string.toLowerCase().toCharArray();
boolean firstLetter = false;
boolean hitSep = false;
int i, j;
tempChar[0] = Character.toUpperCase(tempChar[0]);
for (i = 1; i < string.length(); i++) {
    if (firstLetter) {
...
StringtoTitleCaseIdentifier(String formStr)
to Title Case Identifier
return getTitleCase(toCamelCaseIdentifier(formStr));