| java.lang.Object | |||
| ↳ | java.text.Format | ||
| ↳ | java.text.NumberFormat | ||
| ↳ | java.text.DecimalFormat | ||
DecimalFormat is used to format and parse numbers, both integers and fractions, based on a pattern. The pattern characters used can be either localized or non-localized.
|
[Expand]
Inherited Constants | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.text.NumberFormat
| |||||||||||
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a new DecimalFormat for formatting and parsing numbers for the
default Locale.
| |||||||||||
Constructs a new DecimalFormat using the specified non-localized pattern
and the DecimalFormatSymbols for the default Locale.
| |||||||||||
Constructs a new DecimalFormat using the specified non-localized pattern
and DecimalFormatSymbols.
| |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Changes the pattern of this DecimalFormat to the specified pattern which
uses localized pattern characters.
| |||||||||||
Changes the pattern of this SimpleDateFormat to the specified pattern
which uses non-localized pattern characters.
| |||||||||||
Returns a new instance of DecimalFormat with the same pattern and
properties as this DecimalFormat.
| |||||||||||
Compares the specified object to this DecimalFormat and answer if they
are equal.
| |||||||||||
Formats the number into the specified StringBuffer using the pattern of
this DecimalFormat.
| |||||||||||
Formats the double value into the specified StringBuffer using the
pattern of this DecimalFormat.
| |||||||||||
Formats the long value into the specified StringBuffer using the pattern
of this DecimalFormat.
| |||||||||||
Formats the specified object using the rules of this DecimalNumberFormat
and returns an AttributedCharacterIterator with the formatted number and
attributes.
| |||||||||||
Returns the currency used by this decimal format.
| |||||||||||
Returns the DecimalFormatSymbols used by this DecimalFormat.
| |||||||||||
Returns the number of digits grouped together by the grouping separator.
| |||||||||||
Returns the multiplier which is applied to the number before formatting
or after parsing.
| |||||||||||
Returns the prefix which is formatted or parsed before a negative number.
| |||||||||||
Returns the suffix which is formatted or parsed after a negative number.
| |||||||||||
Returns the prefix which is formatted or parsed before a positive number.
| |||||||||||
Returns the suffix which is formatted or parsed after a positive number.
| |||||||||||
Returns an integer hash code for the receiver.
| |||||||||||
Returns whether the decimal separator is shown when there are no
fractional digits.
| |||||||||||
This value indicates whether grouping will be used in this format.
| |||||||||||
This value indicates whether the return object of the parse operation
will be of type BigDecimal.
| |||||||||||
Returns true if this
DecimalFormat's all resulting number
will be of type java.lang.Integer | |||||||||||
Parse a Long or Double from the specified String starting at the index
specified by the ParsePosition.
| |||||||||||
Sets the currency used by this decimal format.
| |||||||||||
Sets the DecimalFormatSymbols used by this DecimalFormat.
| |||||||||||
Sets whether the decimal separator is shown when there are no fractional
digits.
| |||||||||||
Sets the number of digits grouped together by the grouping separator.
| |||||||||||
Sets whether or not grouping will be used in this format.
| |||||||||||
Sets the maximum number of fraction digits that are printed when
formatting.
| |||||||||||
Sets the maximum number 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.
| |||||||||||
Sets the multiplier which is applied to the number before formatting or
after parsing.
| |||||||||||
Sets the prefix which is formatted or parsed before a negative number.
| |||||||||||
Sets the suffix which is formatted or parsed after a negative number.
| |||||||||||
Let users change the behavior of a DecimalFormat, If set to true all the
returned objects will be of type BigDecimal
| |||||||||||
When DecimalFormat is used to parsing, and this value is set to true,
then all the resulting number will be of type
java.lang.Integer. | |||||||||||
Sets the prefix which is formatted or parsed before a positive number.
| |||||||||||
Sets the suffix which is formatted or parsed after a positive number.
| |||||||||||
Returns the pattern of this DecimalFormat using localized pattern
characters.
| |||||||||||
Returns the pattern of this DecimalFormat using non-localized pattern
characters.
| |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class java.text.NumberFormat
| |||||||||||
From class java.text.Format
| |||||||||||
From class java.lang.Object
| |||||||||||
Constructs a new DecimalFormat for formatting and parsing numbers for the default Locale.
Constructs a new DecimalFormat using the specified non-localized pattern and the DecimalFormatSymbols for the default Locale.
| pattern | the non-localized pattern |
|---|
| IllegalArgumentException | when the pattern cannot be parsed |
|---|
Constructs a new DecimalFormat using the specified non-localized pattern and DecimalFormatSymbols.
| pattern | the non-localized pattern |
|---|---|
| value | the DecimalFormatSymbols |
| IllegalArgumentException | when the pattern cannot be parsed |
|---|
Changes the pattern of this DecimalFormat to the specified pattern which uses localized pattern characters.
| pattern | the localized pattern |
|---|
| IllegalArgumentException | when the pattern cannot be parsed |
|---|
Changes the pattern of this SimpleDateFormat to the specified pattern which uses non-localized pattern characters.
| pattern | the non-localized pattern |
|---|
| IllegalArgumentException | when the pattern cannot be parsed |
|---|
Returns a new instance of DecimalFormat with the same pattern and properties as this DecimalFormat.
Compares the specified object to this DecimalFormat and answer if they are equal. The object must be an instance of DecimalFormat with the same pattern and properties.
| object | the object to compare with this object |
|---|
Formats the number into the specified StringBuffer using the pattern of this DecimalFormat. If the field specified by the FieldPosition is formatted, set the begin and end index of the formatted field in the FieldPosition.
| number | the object to format |
|---|---|
| toAppendTo | the StringBuffer |
| pos | the FieldPosition |
buffer| IllegalArgumentException | if the given number is not instance of Number
|
|---|
Formats the double value into the specified StringBuffer using the pattern of this DecimalFormat. 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 |
| position | the FieldPosition |
buffer
Formats the long value into the specified StringBuffer using the pattern of this DecimalFormat. 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 |
| position | the FieldPosition |
buffer
Formats the specified object using the rules of this DecimalNumberFormat and returns an AttributedCharacterIterator with the formatted number and attributes.
| object | the object to format |
|---|
| NullPointerException | when the object is null |
|---|---|
| IllegalArgumentException | when the object cannot be formatted by this Format |
Returns the currency used by this decimal format.
Returns the DecimalFormatSymbols used by this DecimalFormat.
Returns the number of digits grouped together by the grouping separator.
Returns the multiplier which is applied to the number before formatting or after parsing.
Returns the prefix which is formatted or parsed before a negative number.
Returns the suffix which is formatted or parsed after a negative number.
Returns the prefix which is formatted or parsed before a positive number.
Returns the suffix which is formatted or parsed after a positive number.
Returns an integer hash code for the receiver. Objects which are equal answer the same value for this method.
Returns whether the decimal separator is shown when there are no fractional digits.
This value indicates whether grouping will be used in this format.
This value indicates whether the return object of the parse operation will be of type BigDecimal. This value will default to false.
Returns true if this DecimalFormat's all resulting number
will be of type java.lang.Integer
DecimalFormat's all resulting number
will be of type java.lang.Integer
Parse a Long or Double 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 decimal format. The min and max fraction digits remain the same.
| currency | the new Currency |
|---|
Sets the DecimalFormatSymbols used by this DecimalFormat.
| value | the DecimalFormatSymbols |
|---|
Sets whether the decimal separator is shown when there are no fractional digits.
| value | true if the decimal separator should always be formatted, false otherwise |
|---|
Sets the number of digits grouped together by the grouping separator.
| value | the number of digits grouped together |
|---|
Sets whether or not grouping will be used in this format. Grouping affects both parsing and formatting.
| value | true if uses grouping,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. Limit the maximum to DOUBLE_FRACTION_DIGITS.
| value | the maximum number of fraction digits |
|---|
Sets 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. Limit the maximum to DOUBLE_INTEGER_DIGITS.
| value | the maximum number of integer digits |
|---|
Sets the minimum number of fraction digits that are printed when formatting. Limit the minimum to DOUBLE_FRACTION_DIGITS.
| value | the minimum number of fraction digits |
|---|
Sets the minimum number of integer digits that are printed when formatting. Limit the minimum to DOUBLE_INTEGER_DIGITS.
| value | the minimum number of integer digits |
|---|
Sets the multiplier which is applied to the number before formatting or after parsing.
| value | the multiplier |
|---|
Sets the prefix which is formatted or parsed before a negative number.
| value | the negative prefix |
|---|
Sets the suffix which is formatted or parsed after a negative number.
| value | the negative suffix |
|---|
Let users change the behavior of a DecimalFormat, If set to true all the returned objects will be of type BigDecimal
| newValue | true if all the returned objects should be type of BigDecimal |
|---|
When DecimalFormat is used to parsing, and this value is set to true,
then all the resulting number will be of type
java.lang.Integer. Except that, NaN, positive and
negative infinity are still returned as java.lang.Double
In this implementation, com.ibm.icu4jni.text.DecimalFormat is wrapped to
fulfill most of the format and parse feature. And this method is
delegated to the wrapped instance of com.ibm.icu4jni.text.DecimalFormat.
| value | If set to true, all the resulting number will be of type java.lang.Integer except some special cases. |
|---|
Sets the prefix which is formatted or parsed before a positive number.
| value | the positive prefix |
|---|
Sets the suffix which is formatted or parsed after a positive number.
| value | the positive suffix |
|---|
Returns the pattern of this DecimalFormat using localized pattern characters.
Returns the pattern of this DecimalFormat using non-localized pattern characters.