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 value)
Capitalize.
if (value == null) {
    return value;
return value.substring(0, 1).toUpperCase() + value.substring(1);
Stringcapitalize(String var)
capitalize
return capitalize(var, false);
Stringcapitalize(String word)
capitalize
String capitalizedWord = word;
if (Character.isLowerCase(word.charAt(0))) {
    capitalizedWord = "" + Character.toUpperCase(word.charAt(0)) + word.substring(1);
return capitalizedWord;
Stringcapitalize(String word)
capitalize
String[] words = word.split(" ");
StringBuilder res = new StringBuilder();
for (String w : words) {
    res.append(capitalizeSingle(w));
return res.toString();
Stringcapitalize(String word)
Capitalize the first word of the passed String.
if (word == null)
    return null;
if (word.length() == 0)
    return word;
StringBuilder s = new StringBuilder(word.toLowerCase());
char c = s.charAt(0);
s.setCharAt(0, Character.toUpperCase(c));
return s.toString();
...
Stringcapitalize(String word)
capitalize
if (word.length() == 0)
    return word;
switch (word) {
case "of":
case "the":
case "in":
case "with":
case "and":
...
Stringcapitalize(String word)
capitalize
StringBuilder buff = new StringBuilder(word);
if (word.charAt(0) != '_') {
    buff.setCharAt(0, Character.toUpperCase(word.charAt(0)));
for (int i = 1; i < buff.length(); i++) {
    if (buff.charAt(i - 1) == '_') {
        buff.setCharAt(i, Character.toUpperCase(word.charAt(i)));
return buff.toString().replace("_", "");
Stringcapitalize(String word)
capitalize
if (isBlank(word)) {
    return word;
} else {
    return word.substring(0, 1).toUpperCase() + word.substring(1).toLowerCase();
Stringcapitalize(String word)
capitalize
StringBuilder sb = new StringBuilder(word);
sb.setCharAt(0, Character.toUpperCase(sb.charAt(0)));
return sb.toString();
Stringcapitalize(String words)
capitalize
StringBuffer buffer = new StringBuffer();
boolean isNewWord = true;
int length = words.length();
for (int i = 0; i < length; ++i) {
    char c = words.charAt(i);
    if (Character.isWhitespace(c)) {
        isNewWord = true;
    } else if (isNewWord) {
...