Java Utililty Methods String Upper Case

List of utility methods to do String Upper Case

Description

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

Method

StringtoUpperCaseAtFirstChar(String string)
to Upper Case At First Char
if (isEmpty(string)) {
    return "";
StringBuffer buffer = new StringBuffer();
buffer.append(string.substring(0, 1).toUpperCase());
buffer.append(string.substring(1, string.length()));
return buffer.toString();
StringtoUpperCaseFirst(String str)
to Upper Case First
if (str == null)
    return null;
if ("".equals(str))
    return str;
String first = String.valueOf(str.charAt(0));
str.replaceFirst(first, first.toUpperCase());
return str;
StringtoUpperCaseFirst(String str)
to Upper Case First
if (str == null) {
    return null;
} else if (str.length() == 0) {
    return str;
} else {
    String pre = String.valueOf(str.charAt(0));
    return str.replaceFirst(pre, pre.toUpperCase());
StringtoUpperCaseFirst(String str)
to Upper Case First
return str.replaceFirst(str.substring(0, 1), str.substring(0, 1).toUpperCase());
StringtoUpperCaseFirst(String text)
Changes the first character of the given text to upper case.
char[] charArray = text.toCharArray();
charArray[0] = Character.toUpperCase(charArray[0]);
return String.valueOf(charArray);
StringtoUpperCaseFirst(String text)
to Upper Case First
return text.substring(0, 1).toUpperCase() + text.substring(1);
StringtoUpperCaseFirstAll(String text)
Changes the first character of all words in the given text to uppercase.
StringBuilder result = new StringBuilder();
String[] words = text.split("\\s");
for (int i = 0; i < words.length; i++) {
    result.append(toUpperCaseFirst(words[i]));
    if (i < words.length - 1) {
        result.append(" ");
return result.toString();
StringtoUpperCaseFirstChar(final String str)
Method used to change to upper case the first character of a given string.
String firstChar = str.substring(0, 1);
firstChar = firstChar.toUpperCase();
String lastChars = str.substring(1, str.length());
return firstChar + lastChars;
StringtoUpperCaseFirstChar(String s)
to Upper Case First Char
if (s != null && s.length() > 0) {
    return Character.toUpperCase(s.charAt(0)) + s.substring(1);
} else {
    return s;
StringtoUpperCaseFirstChar(String str)
set the first character into low case.
if (str != null && str.length() > 0) {
    if (str.length() == 1) {
        str = str.toUpperCase();
    } else {
        str = str.substring(0, 1).toUpperCase() + str.substring(1);
return str;
...