ChoiceFormat: Numeric range formatting

See the original posting on JavaWorld

The Javadoc for the ChoiceFormat class states that ChoiceFormat “allows you to attach a format to a range of numbers” and is “generally used in a MessageFormat for handling plurals.” This post describesjava.text.ChoiceFormat and provides some examples of applying it in Java code.

One of the most noticeable differences between ChoiceFormat and other “format” classes in the java.text package is that ChoiceFormat does not provide static methods for accessing instances of ChoiceFormat. Instead, ChoiceFormat provides two constructors that are used for instantiating ChoiceFormat objects. The Javadoc for ChoiceFormat highlights and explains this:

To read this article in full or to leave a comment, please click here