Java String Capitalize capitalize(CharSequence s)

Here you can find the source of capitalize(CharSequence s)

Description

capitalize

License

Apache License

Declaration

public static String capitalize(CharSequence s) 

Method Source Code

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

public class Main {

    public static String capitalize(CharSequence s) {
        if (null == s)
            return null;
        int len = s.length();
        if (len == 0)
            return "";
        char char0 = s.charAt(0);
        if (Character.isUpperCase(char0))
            return s.toString();
        return new StringBuilder(len).append(Character.toUpperCase(char0)).append(s.subSequence(1, len)).toString();
    }/* ww w .  j  a v  a2s .c  o  m*/
}

Related

  1. capitaliseName(String name)
  2. capitalizar(String s)
  3. capitalizarPalabra(String palabra)
  4. capitalizarTexto(String texto)
  5. capitalize(CharSequence s)
  6. capitalize(final String docName)
  7. capitalize(final String input)
  8. capitalize(final String name)
  9. capitalize(final String s)