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

StringtoUpperCaseFirstChar(String str)
to Upper Case First Char
if (str == null || str.length() == 0) {
    return null;
if (Character.isUpperCase(str.charAt(0))) {
    return str;
} else {
    return (new StringBuilder()).append(Character.toUpperCase(str.charAt(0))).append(str.substring(1))
            .toString();
...
StringtoUpperCaseFirstChar(String string)
to Upper Case First Char
return string == null ? null : string.toUpperCase().charAt(0) + string.substring(1);
StringtoUpperCaseFirstChar(String string)
to Upper Case First Char
if (string == null || string.length() == 0) {
    return string;
} else {
    char[] charArray = string.toCharArray();
    for (int i = 0; i < charArray.length; i++) {
        if (i == 0) {
            charArray[0] = Character.toUpperCase(charArray[0]);
        } else {
...
StringtoUpperCaseFirstChar(String text)
Transforms "some text" into "Some text"
if (text != null && text.length() > 0) {
    return text.substring(0, 1).toUpperCase() + text.substring(1);
return text;
StringtoUppercaseFirstCharacter(String s)
to Uppercase First Character
if (s == null || s.length() == 0) {
    return s;
return Character.toUpperCase(s.charAt(0)) + (s.length() > 1 ? s.substring(1) : "");
StringtoUpperCaseFirstCharacter(String str)
to Upper Case First Character
return str.substring(0, 1).toUpperCase() + str.substring(1);
StringtoUpperCaseFirstCharForWord(String string)
to Upper Case First Char For Word
if (string == null || string.length() == 0) {
    return string;
} else {
    StringBuilder palavra = new StringBuilder();
    String[] words = string.split(" ");
    char[] charArray = null;
    for (String word : words) {
        charArray = word.toCharArray();
...
StringtoUpperCaseFirstLetter(String str)
to Upper Case First Letter
return str.substring(0, 1).toUpperCase() + str.substring(1);
StringtoUppercaseFirstLetter(String str)
to Uppercase First Letter
if (str == null || str.length() == 0) {
    return str;
char firstLetter = str.charAt(0);
if (Character.isLowerCase(firstLetter)) {
    if (str.length() > 1) {
        return "" + Character.toUpperCase(firstLetter) + str.substring(1);
    } else {
...
voidtoUpperCaseFirstLetter(StringBuilder sb)
to Upper Case First Letter
char first = sb.charAt(0);
first = Character.toUpperCase(first);
sb.setCharAt(0, first);