Mega Code Archive

 
Categories / Java / Data Type
 

Capitalize the first letter but leave the rest as they are

public class Main {   /**    * <p>    * Capitalize the first letter but leave the rest as they are.    * </p>      *    * @param data capitalize this    * @return String    */   static public String capitalizeFirstLetter ( String data )   {       String firstLetter = data.substring(0,1).toUpperCase();       String restLetters = data.substring(1);       return firstLetter + restLetters;   } }