Java String Capitalize capitalize(String s)

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

Description

Capitalize the first letter in the word

License

GNU General Public License

Declaration

public static String capitalize(String s) 

Method Source Code

//package com.java2s;

public class Main {
    /**//from  w ww.  j  a  va 2 s  . c  o m
     * Capitalize the first letter in the word
     */
    public static String capitalize(String s) {
        if (s.length() > 1)
            return s.substring(0, 1).toUpperCase() + s.substring(1);
        else if (s.length() == 1)
            return s.toUpperCase();
        else
            return s;
    }
}

Related

  1. capitalize(String propertyName)
  2. capitalize(String pString)
  3. capitalize(String s)
  4. capitalize(String s)
  5. capitalize(String s)
  6. capitalize(String s)
  7. capitalize(String s)
  8. capitalize(String s)
  9. capitalize(String s)