Client and backend. This class is shared: the same code is compiled into your app and into your server, so everything on this page works in both.
public class ChoiceFormat
- Object
- Format
- NumberFormat
- ChoiceFormat
ImplementsCloneable, Serializable
Picks a string by the range a number falls in. It is what the choice element of a
MessageFormat pattern uses to write plurals.
A pattern is a list of limit#text pairs separated by |, the limits
ascending: 0#no files|1#one file|1<{0} files. A number selects the last
pair whose limit it reaches; # includes the limit itself and < starts
just above it. A number below the first limit selects the first pair. A
single quote makes the characters up to the next one literal, and two in a
row stand for one quote.
Constructors
public ChoiceFormat(String newPattern) | |
public ChoiceFormat(double[] limits, String[] formats) |
Methods
Inherited fields
Inherited methods
From NumberFormat
getInstance, getInstance, getNumberInstance, getNumberInstance, getIntegerInstance, getIntegerInstance, getPercentInstance, getPercentInstance, getCurrencyInstance, getCurrencyInstance, format, format, format, parse, parseObject, isParseIntegerOnly, setParseIntegerOnly, isGroupingUsed, setGroupingUsed, getMaximumIntegerDigits, setMaximumIntegerDigits, getMinimumIntegerDigits, setMinimumIntegerDigits, getMaximumFractionDigits, setMaximumFractionDigits, getMinimumFractionDigits, setMinimumFractionDigits
From Format
Constructor details
ChoiceFormat
public ChoiceFormat(String newPattern)ChoiceFormat
public ChoiceFormat(double[] limits, String[] formats)Method details
applyPattern
public void applyPattern(String newPattern)toPattern
public String toPattern()setChoices
public void setChoices(double[] limits, String[] formats)getLimits
public double[] getLimits()getFormats
public Object[] getFormats()format
public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition status)format
public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition status)parse
public Number parse(String text, ParsePosition status)Double. When none does, the
error index is set and the answer is not-a-number.nextDouble
public static final double nextDouble(double d)previousDouble
public static final double previousDouble(double d)nextDouble
public static double nextDouble(double d, boolean positive)double next to d: the next greater when positive, else the
next smaller.clone
public Object clone()Object.clone() answers null on the device for anything but an
array.hashCode
public int hashCode()equals
public boolean equals(Object obj)