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

StringtoUpperCase(String src)
Safely convert the string to uppercase.
if (src == null) {
    return null;
} else {
    return src.toUpperCase();
StringtoUpperCase(String str)
to Upper Case
int len = str.length();
char c;
for (int i = 0; i < len; i++) {
    c = str.charAt(i);
    if (!((c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9'))) {
        return str.toUpperCase();
return str;
StringtoUpperCase(String str)
to Upper Case
String newStr = convertBasicLatinToUpper(str);
if (newStr == null) {
    return str.toUpperCase();
return newStr;
StringtoUpperCase(String str)
Non-localized version, be careful
if (str != null) {
    return str.toUpperCase();
return null;
StringtoUpperCase(String str)
to Upper Case
StringBuffer buffer = new StringBuffer(str);
for (int i = 0; i < buffer.length(); i++) {
    char c = buffer.charAt(i);
    buffer.setCharAt(i, Character.toUpperCase(c));
return buffer.toString();
StringtoUpperCase(String string)
A locale independent version of toUpperCase.
boolean changed = false;
char[] chars = string.toCharArray();
for (int i = 0; i != chars.length; i++) {
    char ch = chars[i];
    if ('a' <= ch && 'z' >= ch) {
        changed = true;
        chars[i] = (char) (ch - 'a' + 'A');
if (changed) {
    return new String(chars);
return string;
StringtoUpperCase(String string)
Makes sure that the first character in a string is upper case.
return Character.toString(string.charAt(0)).toUpperCase() + string.substring(1);
StringtoUpperCase(String text)
to Upper Case
if (text == null) {
    return null;
} else {
    return text.toUpperCase();
StringtoUpperCase(String text)
to upper case like XXX_XXX_XXX
if (text != null && text.length() > 0) {
    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < text.length(); i++) {
        char c = text.charAt(i);
        if (i != 0 && Character.isUpperCase(c)) {
            sb.append("_");
        sb.append(Character.toUpperCase(c));
...
StringtoUpperCase(String text)
to Upper Case
if (text != null) {
    int len = text.length();
    if (len > 0) {
        char[] buf = new char[len];
        for (int i = 0; i < len; i++) {
            buf[i] = Character.toUpperCase(text.charAt(i));
        text = new String(buf);
...