NumberFormat and extends it to also support the rational number format.
eg. 5÷3
| Modifier and Type | Field and Description |
|---|---|
| private final NumberFormat | |
| private static final long |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public StringBuffer | format(double
the double number to format number, StringBuffer the StringBuffer to which the formatted text is to be
appended toAppendTo, FieldPosition keeps track on the position of the field within the
returned string. For example, for formatting a number
pos)1234567.89 in Locale.US locale,
if the given fieldPosition is
NumberFormat#INTEGER_FIELD, the begin index
and end index of fieldPosition will be set
to 0 and 9, respectively for the output string
1,234,567.89.Implements abstract java. Specialization of format. |
| public StringBuffer | format(long
the long number to format number, StringBuffer the StringBuffer to which the formatted text is to be
appended toAppendTo, FieldPosition keeps track on the position of the field within the
returned string. For example, for formatting a number
pos)123456789 in Locale.US locale,
if the given fieldPosition is
NumberFormat#INTEGER_FIELD, the begin index
and end index of fieldPosition will be set
to 0 and 11, respectively for the output string
123,456,789.Implements abstract java. Specialization of format. |
| public Number | parse(String
the source, ParsePosition String to parseA parsePosition)ParsePosition object with index and error
index information as described above.Implements abstract java. Parses text from the beginning of the given string to produce a |
| public static RationalNumberFormat |
| numberFormat | back to summary |
|---|---|
| private final NumberFormat numberFormat | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| RationalNumberFormat | back to summary |
|---|---|
| private RationalNumberFormat(NumberFormat numberFormat) | |
| format | back to summary |
|---|---|
| public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) Implements abstract java. Doc from java. Specialization of format.
| |
| format | back to summary |
|---|---|
| public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) Implements abstract java. Doc from java. Specialization of format.
| |
| parse | back to summary |
|---|---|
| public Number parse(String source, ParsePosition parsePosition) Implements abstract java. Doc from java. Parses text from the beginning of the given string to produce a
This method attempts to parse text starting at the index given by the
This method will return a Long if possible (e.g., within the range [Long.MIN_VALUE, Long.MAX_VALUE] and with no decimals), otherwise a Double.
| |
| wrap | back to summary |
|---|---|
| public static RationalNumberFormat wrap(NumberFormat numberFormat) | |