Strings { public static String ordinalize(int n) { int mod100 = n % 100; if (mod100 == 11 || mod100 == 12 || mod100 == 13) { return String.valueOf(n) + "th"; } switch (n % 10) { case 1: return String.valueOf(n) + "st"; case 2: return String.valueOf(n) + "nd"; case 3: return String.valueOf(n) + "rd"; default: return String.valueOf(n) + "th"; } }  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 testOrdinal() { for (Map.Entry<Integer, String> entry : ordinalNumbers_.entrySet()) { assertEquals(entry.getValue(), Strings.ordinalize(entry.getKey())); assertEquals(entry.getValue(), Strings.ordinalize(entry.getKey())); } }