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) {
        int strLen = 0;
        if (str != null)
            if ((strLen = str.length()) != 0)
                return str;

        return strLen + Character.toTitleCase(str.charAt(0)) + str.substring(1);
    }/*from   www.ja v  a  2s  .c o m*/

    public static String subString(String src, int length) {
        if (src == null) {
            return null;
        }
        int i = src.length();
        if (i > length) {
            return src.substring(0, length);
        }
        return src;
    }
}

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)
  7. capitalize(String str)
  8. capitalize(String str)
  9. capitalize(String str)