List of utility methods to do String Pluralize
String | pluralise(String str) Returns a pluralised version of the given String if (str == null) { return null; return str + "s"; |
String | pluralise(String string, double size) pluralise return size > 1 ? string + (string.endsWith("s") ? "es" : "s") : string; |
String | pluraliseInc(int num, String word) Returns the given word, pluralised by adding a postfix 's' if applicable, and prefixed by the given number. return num + " " + pluralise(num, word); |
String | pluraliseNoun(String noun, long count, boolean forceAppendingSByDefault) Performs naive pluralisation of the supplied noun. if (count % 10 != 1 || count == 11) { if (!forceAppendingSByDefault && noun.endsWith("y")) { return (noun.substring(0, noun.length() - 1) + "ies"); } else { return (noun + "s"); } else { return noun; ... |
String | pluralize(final int count, final String singular, final String plural) Returns the plural word, unless count is 1 or -1.
switch (count) { case -1: case 1: return String.format(singular, count); default: return String.format(plural, count); |
String | pluralize(final String s) pluralize String _xifexpression = null; boolean _endsWith = s.endsWith("y"); if (_endsWith) { int _length = s.length(); int _minus = (_length - 1); String _substring = s.substring(0, _minus); _xifexpression = (_substring + "ies"); } else { ... |
String | pluralize(final String typeName) pluralize if (typeName == null) { throw new IllegalArgumentException("typeName"); if (typeName.endsWith("y")) { return typeName.substring(0, typeName.length() - 1).concat("ies"); } else if (typeName.endsWith("s")) { return typeName; } else if (typeName.equalsIgnoreCase("staff")) { ... |
String | pluralize(int count, final String singular, final String plural) Returns the singular or plural form of a string, based on the count. if (count == 1) return singular; return (plural != null) ? plural : singular + 's'; |
String | pluralize(int count, String single) Return the count and the quantity label as a properly pluralized string. if (count == 1) { return NumberFormat.getNumberInstance().format(count) + " " + single; } else { return NumberFormat.getNumberInstance().format(count) + " " + single + "s"; |
String | pluralize(int count, String singular) Pluralize the singular word, unless count == 1, and concatenate it to the count. return count + " " + pluralize(singular, count); |