Java String Capitalize First capitalizeFirst(String str)

Here you can find the source of capitalizeFirst(String str)

Description

Capitalize the first letter of the string and lowercase the rest of the string.

License

Open Source License

Parameter

Parameter Description
str a parameter

Declaration

public static String capitalizeFirst(String str) 

Method Source Code

//package com.java2s;

public class Main {
    /**// w ww  .  ja v  a 2 s  .  c  om
     * Capitalize the first letter of the string and lowercase the rest of the
     * string.
     * 
     * Example:
     * capitalizeFully("abba ooba SNOOBA") == "Abba ooba snooba"
     * 
     * @param str
     * @return
     */
    public static String capitalizeFirst(String str) {
        return str.substring(0, 1).toUpperCase() + str.substring(1).toLowerCase();
    }
}

Related

  1. capitalizeFirst(String input)
  2. capitalizeFirst(String name)
  3. capitalizeFirst(String rawStr)
  4. capitalizeFirst(String s)
  5. capitalizeFirst(String str)
  6. capitalizeFirst(String str)
  7. capitalizeFirst(String str)
  8. capitalizeFirst(String str)
  9. capitalizeFirst(String str)