Java String Capitalize capitalize(String str)

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

Description

capitalize

License

Apache License

Declaration

public static String capitalize(String str) 

Method Source Code

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

public class Main {
    public static String capitalize(String str) {
        if (isEmpty(str))
            return str;
        char[] cs = str.toCharArray();
        cs[0] = Character.toUpperCase(cs[0]);
        return new String(cs);
    }//w w  w  .  j a v  a2  s . co m

    public static boolean isEmpty(String str) {
        return str == null || str.length() == 0;
    }
}

Related

  1. capitalize(String str)
  2. capitalize(String str)
  3. capitalize(String str)
  4. capitalize(String str)
  5. capitalize(String str)
  6. capitalize(String str, char... delimiters)
  7. capitalize(String str, char[] wordDelimiters)
  8. capitalize(String str, String delim)
  9. capitalize(String str, String delimiter)