Java String Pluralize plural(String arg)

Here you can find the source of plural(String arg)

Description

plural

License

Open Source License

Declaration

public static final String plural(String arg) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static final String plural(String arg) {
        if (arg == null) {
            return "";
        }/*w  ww .  j  a v a2 s  . com*/
        try {
            double a = Double.valueOf(arg);
            if (a == 1.0) {
                return "";
            } else {
                return "s";
            }
        } catch (NumberFormatException e) {
            return "";
        }
    }

    public static final String plural(double arg) {
        return plural(Double.toString(arg));
    }
}

Related

  1. plural(int amount)
  2. plural(int count, String word, String ending)
  3. plural(int nb)
  4. plural(int number, String form1, String form2, String form3)
  5. plural(int size, String name)
  6. plural(String objectName)
  7. plural(String singular)
  8. plural(String str, String suffix, int count)
  9. plural(String strSingle, String strPlural, int amount)