public class PluralFormat
extends java.lang.Object
| Constructor and Description |
|---|
PluralFormat(java.util.Locale locale,
java.lang.String pattern) |
PluralFormat(java.lang.String pattern) |
| Modifier and Type | Method and Description |
|---|---|
void |
applyPattern(java.lang.String pattern)
Sets the pattern used by this plural format.
|
java.lang.String |
format(double number) |
java.lang.StringBuilder |
format(java.lang.Object number,
java.lang.StringBuilder toAppendTo,
java.text.FieldPosition pos)
Formats a plural message for a given number and appends the formatted
message to the given
StringBuffer. |
public PluralFormat(java.lang.String pattern)
public PluralFormat(java.util.Locale locale,
java.lang.String pattern)
public void applyPattern(java.lang.String pattern)
pattern - the pattern for this plural format.java.lang.IllegalArgumentException - if the pattern is invalid.public final java.lang.String format(double number)
public java.lang.StringBuilder format(java.lang.Object number,
java.lang.StringBuilder toAppendTo,
java.text.FieldPosition pos)
StringBuffer.number - a number object (instance of Number for which
the plural message should be formatted. If no pattern has been
applied to this PluralFormat object yet, the
formatted number will be returned.
Note: If this object is not an instance of Number,
the toAppendTo will not be modified.toAppendTo - the formatted message will be appended to this
StringBuffer.pos - will be ignored by this method.java.lang.IllegalArgumentException - if number is not an instance of Number