|
|
|
|
Summary of
|
messageFormatPattern := string ( "{" messageFormatElement "}" string )* messageFormatElement := argument { "," elementFormat } elementFormat := "time" { "," datetimeStyle }
| "date" { "," datetimeStyle }
| "number" { "," numberStyle }
| "choice" { "," choiceStyle } datetimeStyle := "short"
| "medium"
| "long"
| "full"
| dateFormatPattern numberStyle := "currency"
| "percent"
| "integer"
| numberFormatPattern choiceStyle := choiceFormatPattern |
Notes:
elementFormat,
then the argument must be a String,
which is substituted.dateTimeStyle
or numberStyle,
then the default format is used (for example, NumberFormat.getInstance,
DateFormat.getTimeInstance,
or DateFormat.getInstance).{"
(curly brace) if necessary. A real single quote is
represented by '' (two successive
single quotes).
Inside a messageFormatElement,
quotes are not removed. For example, {1,number,$'#',##}
will produce a number format with the pound-sign
quoted, with a result such as: "$#31,45".ab {0} de"
and "ab '}' de"
are OK, but "ab
{0'}' de" and "ab } de"
are not.0 to 9, which
corresponds to the arguments presented in an array to
be formatted.ParseException
is thrown. First, format
checks to see if a Format
object has been specified for the argument with the setFormats
method. If so, then format
uses that Format
object to format the argument. Otherwise, the
argument is formatted based on the object's type:
Number,
then format uses NumberFormat.getInstance
to format the argument; Date, then
format uses DateFormat.getDateTimeInstance
to format the argument.toString
method.ChoiceFormatA ChoiceFormat
allows you to attach a format to a range of numbers. It is
generally used in a MessageFormat
for handling plurals. The choice is specified with an
ascending list of doubles,
where each item specifies a half-open interval up to the next
item:
X matches j if and only if limit[j] <= X < limit[j+1]
If there is no match, then either the first or last index
is used, depending on whether the number (X) is too low or
too high.
| The page was last updated February 19, 2008 |