List of utility methods to do String Pluralize
String | pluralize(int count, String singular, String plural) Select singular or plural string based upon count. return (count == 1) ? singular : plural;
|
String | pluralize(int count, String singular, String plural) Returns a singlular or pluralized word. return (count == 1 ? singular : plural);
|
String | pluralize(int count, String word) pluralize return count == 1 ? word : word + 's'; |
String | Pluralize(int quantity, String units) Pluralize if (quantity == 1) { return quantity + " " + units; } else { return quantity + " " + units + "s "; |
String | pluralize(int value, CharSequence singularForm, CharSequence pluralForm) pluralize return Integer.toString(value) + " " + (value == 1 ? singularForm : pluralForm); |
String | pluralize(long count, String singularFormat, String pluralFormat) pluralize return Math.abs(count) == 1 ? String.format(singularFormat, count) : String.format(pluralFormat, count);
|
String | pluralize(long strictlyPositiveCount, String singular, String plural) pluralize if (strictlyPositiveCount == 1) { return "1 " + singular + " ago"; return strictlyPositiveCount + " " + plural + " ago"; |
String | pluralize(long val, String singular, String plural) Determines whether the singular or plural version of a word should be used. return (val == 1) ? singular : plural; |
String | pluralize(String base, int quantity) pluralize if (quantity == 1) return base; else if (base.trim().toLowerCase().endsWith("s")) return base + "es"; else return base + "s"; |
String | pluralize(String input) Pluralize a property name, which is smart about things like nouns ending in 's' or 'y'. String result; if (input.endsWith("ife")) { return input.substring(0, input.length() - 3) + "ives"; } else if (input.endsWith("s") || input.endsWith("sh") || input.endsWith("ch") || input.endsWith("x") || input.endsWith("z")) { result = input.concat("es"); } else if (input.endsWith("f") && !input.substring(input.length() - 2, 1).matches("[efo]")) { return input.substring(0, input.length() - 1) + "ves"; ... |