@Test public void shouldHumanize() { humanize("active_record", "Active record"); humanize("first_name", "First name"); humanize("name", "Name"); humanize("the_first_name", "The first name"); humanize("employee_salary", "Employee salary"); humanize("underground", "Underground"); humanize("id", "Id"); humanize("employee_id", "Employee"); humanize("employee_value_string", "Employee string", "value"); }
public String humanize( String lowerCaseAndUnderscoredWords, String... removableTokens ) { if (lowerCaseAndUnderscoredWords == null) return null; String result = lowerCaseAndUnderscoredWords.trim(); if (result.length() == 0) return ""; result = result.replaceAll("_id$", ""); if (removableTokens != null) { for (String removableToken : removableTokens) { result = result.replaceAll(removableToken, ""); } } result = result.replaceAll("_+", " "); return capitalize(result); }
Inflector { public String humanize( String lowerCaseAndUnderscoredWords, String... removableTokens ) { if (lowerCaseAndUnderscoredWords == null) return null; String result = lowerCaseAndUnderscoredWords.trim(); if (result.length() == 0) return ""; result = result.replaceAll("_id$", ""); if (removableTokens != null) { for (String removableToken : removableTokens) { result = result.replaceAll(removableToken, ""); } } result = result.replaceAll("_+", " "); return capitalize(result); } }
Inflector { public String humanize( String lowerCaseAndUnderscoredWords, String... removableTokens ) { if (lowerCaseAndUnderscoredWords == null) return null; String result = lowerCaseAndUnderscoredWords.trim(); if (result.length() == 0) return ""; result = result.replaceAll("_id$", ""); if (removableTokens != null) { for (String removableToken : removableTokens) { result = result.replaceAll(removableToken, ""); } } result = result.replaceAll("_+", " "); return capitalize(result); } Inflector(); protected  Inflector( Inflector original ); }
Inflector { public String humanize( String lowerCaseAndUnderscoredWords, String... removableTokens ) { if (lowerCaseAndUnderscoredWords == null) return null; String result = lowerCaseAndUnderscoredWords.trim(); if (result.length() == 0) return ""; result = result.replaceAll("_id$", ""); if (removableTokens != null) { for (String removableToken : removableTokens) { result = result.replaceAll(removableToken, ""); } } result = result.replaceAll("_+", " "); return capitalize(result); } 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 humanize( String lowerCaseAndUnderscoredWords, String... removableTokens ) { if (lowerCaseAndUnderscoredWords == null) return null; String result = lowerCaseAndUnderscoredWords.trim(); if (result.length() == 0) return ""; result = result.replaceAll("_id$", ""); if (removableTokens != null) { for (String removableToken : removableTokens) { result = result.replaceAll(removableToken, ""); } } result = result.replaceAll("_+", " "); return capitalize(result); } 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();  }