Java String Capitalize capitalize(final String s)

Here you can find the source of capitalize(final String s)

Description

Capitalizes the first letter of the specified string and makes the rest lowercase.

License

Open Source License

Declaration

public static String capitalize(final String s) 

Method Source Code

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

public class Main {
    /** Capitalizes the first letter of the specified string and makes the rest lowercase. */
    public static String capitalize(final String s) {
        if (s.length() == 0) {
            return s;
        }//from w  ww . ja va 2s.c  om
        return s.substring(0, 1).toUpperCase()
                + s.substring(1).toLowerCase();
    }
}

Related

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