Strings { public static String titleize(String word) { word = humanize(underscore(word)); Pattern p = Pattern.compile("\\b([a-z])"); Matcher m = p.matcher(word); while (m.find()) { word = m.replaceFirst(capitalize(m.group(1))); m = p.matcher(word); } return word; }  static String tableize(String word); static String pluralize(String word); static String singularize(String word); static String underscore(String word); static String camelize(String word); static String camelize(String word, boolean lowercaseFirstLetter); static String depackage(String word); static String foreignKey(String className); static String foreignKey(String className, boolean separateIdWithUnderscore); static String titleize(String word); static String classify(String tableName); static String humanize(String word); static String ordinalize(int n); static String dasherize(String word); static String capitalize(String word);  }
@Test public void testTitleize() { for (Map.Entry<String, String> entry : mixtureToTitleCase_.entrySet()) { assertEquals(entry.getValue(), Strings.titleize(entry.getKey())); } }