Mega Code Archive

 
Categories / Java / Data Type
 

Makes the first letter caps and the rest lowercase

public class Main {   /**    * <p>    *  Makes the first letter caps and the rest lowercase.    * </p>    *    * <p>    *  For example <code>fooBar</code> becomes <code>Foobar</code>.    * </p>    *    * @param data capitalize this    * @return String    */   static public String firstLetterCaps ( String data )   {       String firstLetter = data.substring(0,1).toUpperCase();       String restLetters = data.substring(1).toLowerCase();       return firstLetter + restLetters;   } }