Java String Capitalize First capitalizeFirstLetter(String str)

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

Description

capitalize First Letter

License

Open Source License

Declaration

public static String capitalizeFirstLetter(String str) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static String capitalizeFirstLetter(String str) {
        if (str != null && str.length() == 1) {
            return String.valueOf(str.charAt(0)).toUpperCase();
        } else if (str != null && str.length() > 1) {
            return String.valueOf(str.charAt(0)).toUpperCase()
                    + str.substring(1);/* www .jav  a2 s  . c  om*/
        } else
            return str;
    }
}

Related

  1. capitalizeFirstLetter(String s)
  2. capitalizeFirstLetter(String s)
  3. capitalizeFirstLetter(String str)
  4. capitalizeFirstLetter(String str)
  5. capitalizeFirstLetter(String str)
  6. capitalizeFirstLetter(String str)
  7. capitalizeFirstLetter(String str)
  8. capitalizeFirstLetter(String str)
  9. capitalizeFirstLetter(String string)