Java String Upper Case toUpperCaseFirstChar(String str)

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

Description

to Upper Case First Char

License

Open Source License

Declaration

public static String toUpperCaseFirstChar(String str) 

Method Source Code

//package com.java2s;

public class Main {

    public static String toUpperCaseFirstChar(String str) {
        if (str == null || str.length() == 0) {
            return null;
        }//from   w  w  w.j  av a 2s . com

        if (Character.isUpperCase(str.charAt(0))) {
            return str;
        } else {
            return (new StringBuilder()).append(Character.toUpperCase(str.charAt(0))).append(str.substring(1))
                    .toString();
        }
    }
}

Related

  1. toUpperCaseFirst(String text)
  2. toUpperCaseFirstAll(String text)
  3. toUpperCaseFirstChar(final String str)
  4. toUpperCaseFirstChar(String s)
  5. toUpperCaseFirstChar(String str)
  6. toUpperCaseFirstChar(String string)
  7. toUpperCaseFirstChar(String string)
  8. toUpperCaseFirstChar(String text)
  9. toUppercaseFirstCharacter(String s)