| java.lang.Object | ||
| ↳ | java.text.Format | |
| ↳ | java.text.NumberFormat | |
Known Direct Subclasses
|
NumberFormat is the abstract superclass of Formats which format and parse Numbers.
| Nested Classes | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| NumberFormat.Field | The instances of this inner class are used as attribute keys and values in AttributedCharacterIterator that NumberFormat.formatToCharacterIterator() method returns. | ||||||||||
| Constants | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| int | FRACTION_FIELD | Field constant. | |||||||||
| int | INTEGER_FIELD | Field constant. | |||||||||
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a new instance of DateFormat.
| |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Returns a new NumberFormat with the same properties as this NumberFormat.
| |||||||||||
Compares the specified object to this NumberFormat and answer if they are
equal.
| |||||||||||
Formats the specified long using the rules of this NumberFormat.
| |||||||||||
Formats the specified double using the rules of this NumberFormat.
| |||||||||||
Formats the specified object into the specified StringBuffer using the
rules of this DateFormat.
| |||||||||||
Formats the double value into the specified StringBuffer using the rules
of this NumberFormat.
| |||||||||||
Formats the long value into the specified StringBuffer using the rules of
this NumberFormat.
| |||||||||||
Gets the list of installed Locales which support NumberFormat.
| |||||||||||
Returns the currency used by this number format
This implementation throws UnsupportedOperationException, concrete sub classes should override if they support currency formatting. | |||||||||||
Returns a NumberFormat for formatting and parsing currency for the
default Locale.
| |||||||||||
Returns a NumberFormat for formatting and parsing currency for the
specified Locale.
| |||||||||||
Returns a NumberFormat for formatting and parsing numbers for the default
Locale.
| |||||||||||
Returns a NumberFormat for formatting and parsing numbers for the
specified Locale.
| |||||||||||
Returns a NumberFormat for formatting and parsing integers for the
specified Locale.
| |||||||||||
Returns a NumberFormat for formatting and parsing integers for the
default Locale.
| |||||||||||
Returns the maximum number of fraction digits that are printed when
formatting.
| |||||||||||
Returns the maximum number of integer digits that are printed when
formatting.
| |||||||||||
Returns the minimum number of fraction digits that are printed when
formatting.
| |||||||||||
Returns the minimum number of integer digits that are printed when
formatting.
| |||||||||||
Returns a NumberFormat for formatting and parsing numbers for the
specified Locale.
| |||||||||||
Returns a NumberFormat for formatting and parsing numbers for the default
Locale.
| |||||||||||
Returns a NumberFormat for formatting and parsing percentages for the
default Locale.
| |||||||||||
Returns a NumberFormat for formatting and parsing percentages for the
specified Locale.
| |||||||||||
Returns an integer hash code for the receiver.
| |||||||||||
Returns whether this NumberFormat formats and parses numbers using a
grouping separator.
| |||||||||||
Returns whether this NumberFormat only parses integer numbers.
| |||||||||||
Parse a Number from the specified String using the rules of this
NumberFormat.
| |||||||||||
Parse a Number from the specified String starting at the index specified
by the ParsePosition.
| |||||||||||
Parse a Number from the specified String starting at the index specified
by the ParsePosition.
| |||||||||||
Sets the currency used by this number format when formatting currency
values.
| |||||||||||
Sets whether this NumberFormat formats and parses numbers using a
grouping separator.
| |||||||||||
Sets the maximum number of fraction digits that are printed when
formatting.
| |||||||||||
Used to specify the new maximum count of integer digits that are printed
when formatting.
| |||||||||||
Sets the minimum number of fraction digits that are printed when
formatting.
| |||||||||||
Sets the minimum number of integer digits that are printed when
formatting.
| |||||||||||
Specifies if this NumberFormat should only parse numbers as integers or
else as any kind of number.
| |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class java.text.Format
| |||||||||||
From class java.lang.Object
| |||||||||||
Field constant.
Field constant.
Constructs a new instance of DateFormat.
Returns a new NumberFormat with the same properties as this NumberFormat.
Compares the specified object to this NumberFormat and answer if they are equal. The object must be an instance of NumberFormat and have the same properties.
| object | the object to compare with this object |
|---|
Formats the specified long using the rules of this NumberFormat.
| value | the long to format |
|---|
Formats the specified double using the rules of this NumberFormat.
| value | the double to format |
|---|
Formats the specified object into the specified StringBuffer using the rules of this DateFormat. If the field specified by the FieldPosition is formatted, set the begin and end index of the formatted field in the FieldPosition.
| object | the object to format, must be a Number |
|---|---|
| buffer | the StringBuffer |
| field | the FieldPosition |
buffer| IllegalArgumentException | when the object is not a Number |
|---|
Formats the double value into the specified StringBuffer using the rules of this NumberFormat. If the field specified by the FieldPosition is formatted, set the begin and end index of the formatted field in the FieldPosition.
| value | the double to format |
|---|---|
| buffer | the StringBuffer |
| field | the FieldPosition |
buffer
Formats the long value into the specified StringBuffer using the rules of this NumberFormat. If the field specified by the FieldPosition is formatted, set the begin and end index of the formatted field in the FieldPosition.
| value | the long to format |
|---|---|
| buffer | the StringBuffer |
| field | the FieldPosition |
buffer
Gets the list of installed Locales which support NumberFormat.
Returns the currency used by this number format
This implementation throws UnsupportedOperationException, concrete sub classes should override if they support currency formatting.
Returns a NumberFormat for formatting and parsing currency for the default Locale.
Returns a NumberFormat for formatting and parsing currency for the specified Locale.
| locale | the Locale |
|---|
Returns a NumberFormat for formatting and parsing numbers for the default Locale.
Returns a NumberFormat for formatting and parsing numbers for the specified Locale.
| locale | the Locale |
|---|
Returns a NumberFormat for formatting and parsing integers for the specified Locale.
| locale | the Locale |
|---|
Returns a NumberFormat for formatting and parsing integers for the default Locale.
Returns the maximum number of fraction digits that are printed when formatting. If the maximum is less than the number of fraction digits, the least significant digits are truncated.
Returns the maximum number of integer digits that are printed when formatting. If the maximum is less than the number of integer digits, the most significant digits are truncated.
Returns the minimum number of fraction digits that are printed when formatting.
Returns the minimum number of integer digits that are printed when formatting.
Returns a NumberFormat for formatting and parsing numbers for the specified Locale.
| locale | the Locale |
|---|
Returns a NumberFormat for formatting and parsing numbers for the default Locale.
Returns a NumberFormat for formatting and parsing percentages for the default Locale.
Returns a NumberFormat for formatting and parsing percentages for the specified Locale.
| locale | the Locale |
|---|
Returns an integer hash code for the receiver. Objects which are equal answer the same value for this method.
Returns whether this NumberFormat formats and parses numbers using a grouping separator.
Returns whether this NumberFormat only parses integer numbers. Parsing stops if a decimal separator is encountered.
Parse a Number from the specified String using the rules of this NumberFormat.
| string | the String to parse |
|---|
| ParseException | when an error occurs during parsing |
|---|
Parse a Number from the specified String starting at the index specified by the ParsePosition. If the string is successfully parsed, the index of the ParsePosition is updated to the index following the parsed text.
| string | the String to parse |
|---|---|
| position | the ParsePosition, updated on return with the index following the parsed text, or on error the index is unchanged and the error index is set to the index where the error occurred |
Parse a Number from the specified String starting at the index specified by the ParsePosition. If the string is successfully parsed, the index of the ParsePosition is updated to the index following the parsed text.
| string | the String to parse |
|---|---|
| position | the ParsePosition, updated on return with the index following the parsed text, or on error the index is unchanged and the error index is set to the index where the error occurred |
Sets the currency used by this number format when formatting currency values.
The min and max fraction digits remain the same.
This implementation throws UnsupportedOperationException, concrete sub classes should override if they support currency formatting.
| currency | the new Currency |
|---|
Sets whether this NumberFormat formats and parses numbers using a grouping separator.
| value | true when a grouping separator is used, false otherwise |
|---|
Sets the maximum number of fraction digits that are printed when formatting. If the maximum is less than the number of fraction digits, the least significant digits are truncated.
| value | the maximum number of fraction digits |
|---|
Used to specify the new maximum count of integer digits that are printed when formatting. If the maximum is less than the number of integer digits, the most significant digits are truncated.
| value | the new maximum number of integer numerals for display |
|---|
Sets the minimum number of fraction digits that are printed when formatting.
| value | the minimum number of fraction digits |
|---|
Sets the minimum number of integer digits that are printed when formatting.
| value | the minimum number of integer digits |
|---|
Specifies if this NumberFormat should only parse numbers as integers or
else as any kind of number. If this is called with a true
value then subsequent parsing attempts will stop if a decimal separator
is encountered.
| value | true to only parse integers, false
to parse integers and fractions
|
|---|