Java String Capitalize capitalise(String s)

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

Description

Change the first letter of a string to upper case.

License

Open Source License

Parameter

Parameter Description
s the string.

Return

the string, with the first letter changed to upper case.

Declaration

public static String capitalise(String s) 

Method Source Code

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

public class Main {
    /**/*  w w w .j  ava2s .  c om*/
     * Change the first letter of a string to upper case.
     *
     * @param s the string.
     * @return the string, with the first letter changed to upper case.
     */
    public static String capitalise(String s) {
        return s.isEmpty() ? s : s.charAt(0) + s.substring(1);
    }
}

Related

  1. capitalise(final String name)
  2. capitalise(String line)
  3. capitalise(String name)
  4. capitalise(String s)
  5. capitalise(String s)
  6. capitalise(String s)
  7. capitalise(String str)
  8. capitalise(String str)