Java String Plural toPlural(String name)

Here you can find the source of toPlural(String name)

Description

to Plural

License

Apache License

Declaration

public static String toPlural(String name) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static String toPlural(String name) {
        if (name.endsWith("y")) {
            int length = name.length();
            name = name.substring(0, length - 2);
            return name + "ies";
        }//from  w  w w . j  a va2  s  .c om
        if (name.endsWith("s"))
            return name + "es";
        if (name.equalsIgnoreCase("child"))
            return name + "ren";
        return name + "s";
    }
}

Related

  1. toPlural(String _str)
  2. toPlural(String candidate)
  3. toPlural(String name)
  4. toPluralForm(String propertyName)