Java Utililty Methods String Pluralize

List of utility methods to do String Pluralize

Description

The list of methods to do String Pluralize are organized into topic(s).

Method

Stringpluralize(String word)
Get the plural for the given English word.
if (word == null) {
    throw new IllegalArgumentException();
final String lowerCaseWord = word.toLowerCase();
if (endsWithAny(lowerCaseWord, "s", "sh", "o")) {
    return word + "es";
if (lowerCaseWord.endsWith("y") && !lowerCaseWord.endsWith("ay")
...
Stringpluralize(String word, int count)
pluralize
if (count != 1) {
    return word + "s";
return word;
Stringpluralize(String x, Integer y)
pluralize
return (y == 1 ? x : x + "s");
StringpluralizeName(String name)
pluralize Name
if (name.endsWith("s"))
    return name + "'";
return name + "'s";
StringpluralName(final String name)
plural Name
String pluralName;
if (name.endsWith("y")) {
    pluralName = name.substring(0, name.length() - 1) + "ies";
} else if (name.endsWith("s") || name.endsWith("x")) {
    pluralName = name + "es";
} else {
    pluralName = name + 's';
return pluralName;
StringPluralTemplateHelper(int count, String singularTemplate, String pluralTemplate)
For even more complex sentences, it may just be easiest to provide a template, which will be replaced, if the count is singular or plural.
if (count == 1) {
    return String.format(singularTemplate, count);
} else {
    return String.format(pluralTemplate, count);