PluralRules


public class PluralRules
extends Object implements Serializable

java.lang.Object
   ↳ android.icu.text.PluralRules


Defines rules for mapping non-negative numeric values onto a small set of keywords.

Rules are constructed from a text description, consisting of a series of keywords and conditions. The select(FormattedNumber) method examines each condition in order and returns the keyword for the first condition that matches the number. If none match, KEYWORD_OTHER is returned.

A PluralRules object is immutable. It contains caches for sample values, but those are synchronized.

PluralRules is Serializable so that it can be used in formatters, which are serializable.

For more information, details, and tips for writing rules, see the LDML spec, Part 3.5 Language Plural Rules

Examples:

 "one: n is 1; few: n in 2..4"