Package com.pnfsoftware.jeb.util.format
Class PluralFormatter
java.lang.Object
com.pnfsoftware.jeb.util.format.PluralFormatter
A trivial text formatter that takes quantities into account to produce singular-form or
plural-form tokens.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringProduce the singular or plural form of a token based on a provided count.static StringA specialized, best-effort, and approximate version ofcountthat assumes that the plural form of a provided singular English token is created by appending '-s' (or a variant, such as '-es' ) to the singular token.
-
Constructor Details
-
PluralFormatter
public PluralFormatter()
-
-
Method Details
-
count
Produce the singular or plural form of a token based on a provided count.- Parameters:
cnt- countvalue- singular tokenvaluePlural- plural token (optional)- Returns:
- the resulting string
-
countS
A specialized, best-effort, and approximate version ofcountthat assumes that the plural form of a provided singular English token is created by appending '-s' (or a variant, such as '-es' ) to the singular token.- Parameters:
cnt- countvalue- singular token- Returns:
- the resulting string
-