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

Stringplural(int amount)
Is it second, or seconds?
return amount == 1 ? " " : "s ";
Stringplural(int count, String word, String ending)
Return plural word if count is bigger than one
return count == 1 ? word : word + ending;
Stringplural(int nb)
plural
return nb > 1 ? "s" : "";
Stringplural(int number, String form1, String form2, String form3)
This method return plural form of word based on int value.
int n1 = Math.abs(number) % 100;
int n2 = number % 10;
if (n1 > 10 && n1 < 20)
    return form3;
if (n2 > 1 && n2 < 5)
    return form2;
if (n2 == 1)
    return form1;
...
Stringplural(int size, String name)
plural
return "" + size + " " + name + (size > 1 ? "s" : "");
Stringplural(String arg)
plural
if (arg == null) {
    return "";
try {
    double a = Double.valueOf(arg);
    if (a == 1.0) {
        return "";
    } else {
...
Stringplural(String objectName)
plural
return objectName.endsWith("y") ? objectName.substring(0, objectName.length() - 1) + "ies"
        : objectName + "s";
Stringplural(String singular)
plural
if (singular == null || singular.length() == 0) {
    return singular;
if (singular.equalsIgnoreCase("person")) {
    return singular.charAt(0) + "eople";
} else if (singular.equalsIgnoreCase("child")) {
    return singular.charAt(0) + "hildren";
} else if (singular.equalsIgnoreCase("alumnus")) {
...
Stringplural(String str, String suffix, int count)
plural
if (count == 1)
    return str;
else
    return str + suffix;
Stringplural(String strSingle, String strPlural, int amount)
plural
return String.format(amount == 1 ? strSingle : strPlural, amount);