Java String Capitalize First capitalizeFirstCharacter(String value)

Here you can find the source of capitalizeFirstCharacter(String value)

Description

Method capitalizeFirstCharacter

License

Open Source License

Parameter

Parameter Description
value String

Return

String

Declaration

public static String capitalizeFirstCharacter(String value) 

Method Source Code

//package com.java2s;

public class Main {
    /**/*  ww  w.  jav  a 2  s  .  c om*/
     * Method capitalizeFirstCharacter
     * 
     * @param value String
     * @return String
     */
    public static String capitalizeFirstCharacter(String value) {
        if (isNullOrEmpty(value)) {
            return value;
        }

        char[] chars = value.toCharArray();
        chars[0] = Character.toUpperCase(chars[0]);

        return new String(chars);
    }

    /**
     * Method isNullOrEmpty
     * 
     * @param value String
     * @return boolean
     */
    public static boolean isNullOrEmpty(String value) {
        return (value == null) || (value.length() == 0);
    }
}

Related

  1. capitalizeFirstCharacter(String s)
  2. capitalizeFirstCharacter(String s)
  3. capitalizeFirstCharacter(String str)
  4. capitalizeFirstCharacter(String str)
  5. CapitalizeFirstCharacter(String Str)
  6. capitalizeFirstCharacters(String whole)
  7. capitalizeFirstCharacterString(String item)
  8. capitalizeFirstCharOfString(final String input)
  9. capitalizeFirstLeter(String sentence)