Java String Upper Case toUpperCaseFirst(String str)

Here you can find the source of toUpperCaseFirst(String str)

Description

to Upper Case First

License

Apache License

Declaration

public static String toUpperCaseFirst(String str) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static String toUpperCaseFirst(String str) {
        if (str == null) {
            return null;
        } else if (str.length() == 0) {
            return str;
        } else {//  ww  w . j  av  a 2  s. c om
            String pre = String.valueOf(str.charAt(0));
            return str.replaceFirst(pre, pre.toUpperCase());
        }
    }

    public static String toUpperCase(String instr) {
        return instr == null ? instr : instr.toUpperCase();
    }
}

Related

  1. toUpperCaseArray(String[] source, String[] target)
  2. toUpperCaseAscii(String s)
  3. toUpperCaseAt(String oldString, int index)
  4. toUpperCaseAtFirstChar(String string)
  5. toUpperCaseFirst(String str)
  6. toUpperCaseFirst(String str)
  7. toUpperCaseFirst(String text)
  8. toUpperCaseFirst(String text)
  9. toUpperCaseFirstAll(String text)