Java String Capitalize First capitalizeFirstLetter(String s)

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

Description

capitalize First Letter

License

Apache License

Parameter

Parameter Description
s the string to modify

Return

s with the first letter capitalized

Declaration

public static String capitalizeFirstLetter(String s) 

Method Source Code

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

public class Main {
    /**//from   w w w.  j a v a2s. c o  m
     * @param s the string to modify
     * @return <code>s</code> with the first letter capitalized
     */
    public static String capitalizeFirstLetter(String s) {
        if (s == null || s.isEmpty())
            return s;
        return s.length() == 1 ? s.toUpperCase() : s.substring(0, 1).toUpperCase() + s.substring(1);
    }
}

Related

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