@Test public void shouldCapitalize() { capitalize("active record", "Active record"); capitalize("first name", "First name"); capitalize("name", "Name"); capitalize("the first name", "The first name"); capitalize("employee_salary", "Employee_salary"); capitalize("underground", "Underground"); }
public String capitalize( String words ) { if (words == null) return null; String result = words.trim(); if (result.length() == 0) return ""; if (result.length() == 1) return result.toUpperCase(); return "" + Character.toUpperCase(result.charAt(0)) + result.substring(1).toLowerCase(); }
Inflector { public String capitalize( String words ) { if (words == null) return null; String result = words.trim(); if (result.length() == 0) return ""; if (result.length() == 1) return result.toUpperCase(); return "" + Character.toUpperCase(result.charAt(0)) + result.substring(1).toLowerCase(); } }
Inflector { public String capitalize( String words ) { if (words == null) return null; String result = words.trim(); if (result.length() == 0) return ""; if (result.length() == 1) return result.toUpperCase(); return "" + Character.toUpperCase(result.charAt(0)) + result.substring(1).toLowerCase(); } Inflector(); protected  Inflector( Inflector original ); }
Inflector { public String capitalize( String words ) { if (words == null) return null; String result = words.trim(); if (result.length() == 0) return ""; if (result.length() == 1) return result.toUpperCase(); return "" + Character.toUpperCase(result.charAt(0)) + result.substring(1).toLowerCase(); } Inflector(); protected  Inflector( Inflector original ); static final Inflector getInstance(); @Override Inflector clone(); String pluralize( Object word ); String pluralize( Object word,
                             int count ); String singularize( Object word ); String lowerCamelCase( String lowerCaseAndUnderscoredWord,
                                  char... delimiterChars ); String upperCamelCase( String lowerCaseAndUnderscoredWord,
                                  char... delimiterChars ); String camelCase( String lowerCaseAndUnderscoredWord,
                             boolean uppercaseFirstLetter,
                             char... delimiterChars ); String underscore( String camelCaseWord,
                              char... delimiterChars ); String capitalize( String words ); String humanize( String lowerCaseAndUnderscoredWords,
                            String... removableTokens ); String titleCase( String words,
                             String... removableTokens ); String ordinalize( int number ); boolean isUncountable( String word ); Set<String> getUncountables(); void addPluralize( String rule,
                              String replacement ); void addSingularize( String rule,
                                String replacement ); void addIrregular( String singular,
                              String plural ); void addUncountable( String... words ); void clear(); }
Inflector { public String capitalize( String words ) { if (words == null) return null; String result = words.trim(); if (result.length() == 0) return ""; if (result.length() == 1) return result.toUpperCase(); return "" + Character.toUpperCase(result.charAt(0)) + result.substring(1).toLowerCase(); } Inflector(); protected  Inflector( Inflector original ); static final Inflector getInstance(); @Override Inflector clone(); String pluralize( Object word ); String pluralize( Object word,
                             int count ); String singularize( Object word ); String lowerCamelCase( String lowerCaseAndUnderscoredWord,
                                  char... delimiterChars ); String upperCamelCase( String lowerCaseAndUnderscoredWord,
                                  char... delimiterChars ); String camelCase( String lowerCaseAndUnderscoredWord,
                             boolean uppercaseFirstLetter,
                             char... delimiterChars ); String underscore( String camelCaseWord,
                              char... delimiterChars ); String capitalize( String words ); String humanize( String lowerCaseAndUnderscoredWords,
                            String... removableTokens ); String titleCase( String words,
                             String... removableTokens ); String ordinalize( int number ); boolean isUncountable( String word ); Set<String> getUncountables(); void addPluralize( String rule,
                              String replacement ); void addSingularize( String rule,
                                String replacement ); void addIrregular( String singular,
                              String plural ); void addUncountable( String... words ); void clear();  }