Java String Capitalize First capitalizeFirstLetter(String s)

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

Description

Capitalizes the first letter of the given String.

License

Open Source License

Parameter

Parameter Description
s the string to capitalize

Return

String with a capitalized first letter

Declaration

public static String capitalizeFirstLetter(String s) 

Method Source Code

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

public class Main {
    /**//from w  ww.  j av  a  2s  .  c om
     * Capitalizes the first letter of the given String.
     *
     * @param s the string to capitalize
     * @return String with a capitalized first letter
     */
    public static String capitalizeFirstLetter(String s) {

        char[] chars = s.toCharArray();
        chars[0] = Character.toUpperCase(chars[0]);
        return new String(chars);

    }
}

Related

  1. capitalizeFirstLetter(String data)
  2. capitalizeFirstLetter(String data)
  3. capitalizeFirstLetter(String message)
  4. CapitalizeFirstLetter(String name)
  5. capitalizeFirstLetter(String s)
  6. capitalizeFirstLetter(String s)
  7. capitalizeFirstLetter(String s)
  8. capitalizeFirstLetter(String s)
  9. capitalizeFirstLetter(String str)