public class FormattedNumber
extends java.lang.Object
NumberFormatter
Modifier and Type | Method and Description |
---|---|
<A extends java.lang.Appendable> |
appendTo(A appendable)
Append the formatted number to an Appendable, such as a StringBuilder.
|
boolean |
equals(java.lang.Object other) |
java.text.AttributedCharacterIterator |
getFieldIterator()
Deprecated.
ICU 62 Use
toCharacterIterator() instead. This method will be removed in a future
release. See http://bugs.icu-project.org/trac/ticket/13746 |
PluralRules.IFixedDecimal |
getFixedDecimal()
Deprecated.
This API is ICU internal only.
|
int |
hashCode() |
boolean |
nextFieldPosition(java.text.FieldPosition fieldPosition)
Determines the start and end indices of the next occurrence of the given field in the
output string.
|
void |
populateFieldPosition(java.text.FieldPosition fieldPosition)
Deprecated.
ICU 62 Use
nextFieldPosition(java.text.FieldPosition) instead. This method will be removed in a future
release. See http://bugs.icu-project.org/trac/ticket/13746 |
java.math.BigDecimal |
toBigDecimal()
Export the formatted number as a BigDecimal.
|
java.text.AttributedCharacterIterator |
toCharacterIterator()
Export the formatted number as an AttributedCharacterIterator.
|
java.lang.String |
toString()
Creates a String representation of the the formatted number.
|
public java.lang.String toString()
toString
in class java.lang.Object
NumberFormatter
public <A extends java.lang.Appendable> A appendTo(A appendable)
If an IOException occurs when appending to the Appendable, an unchecked
ICUUncheckedIOException
is thrown instead.
appendable
- The Appendable to which to append the formatted number string.Appendable
,
NumberFormatter
@Deprecated public void populateFieldPosition(java.text.FieldPosition fieldPosition)
nextFieldPosition(java.text.FieldPosition)
instead. This method will be removed in a future
release. See http://bugs.icu-project.org/trac/ticket/13746If multiple different field attributes are needed, this method can be called repeatedly, or if all field attributes are needed, consider using getFieldIterator().
If a field occurs multiple times in an output string, such as a grouping separator, this method will only ever return the first occurrence. Use getFieldIterator() to access all occurrences of an attribute.
fieldPosition
- The FieldPosition to populate with the start and end indices of the desired field.NumberFormat.Field
,
NumberFormatter
public boolean nextFieldPosition(java.text.FieldPosition fieldPosition)
If a field occurs just once, calling this method will find that occurrence and return it. If a field occurs multiple times, this method may be called repeatedly with the following pattern:
FieldPosition fpos = new FieldPosition(NumberFormat.Field.GROUPING_SEPARATOR); while (formattedNumber.nextFieldPosition(fpos, status)) { // do something with fpos. }
This method is useful if you know which field to query. If you want all available field position
information, use toCharacterIterator()
.
fieldPosition
- Input+output variable. On input, the "field" property determines which field to look
up, and the "beginIndex" and "endIndex" properties determine where to begin the search.
On output, the "beginIndex" is set to the beginning of the first occurrence of the
field with either begin or end indices after the input indices, "endIndex" is set to
the end of that occurrence of the field (exclusive index). If a field position is not
found, the method returns FALSE and the FieldPosition may or may not be changed.NumberFormat.Field
,
NumberFormatter
@Deprecated public java.text.AttributedCharacterIterator getFieldIterator()
toCharacterIterator()
instead. This method will be removed in a future
release. See http://bugs.icu-project.org/trac/ticket/13746If information on only one field is needed, consider using populateFieldPosition() instead.
NumberFormat.Field
,
AttributedCharacterIterator
,
NumberFormatter
public java.text.AttributedCharacterIterator toCharacterIterator()
If information on only one field is needed, use nextFieldPosition(FieldPosition)
instead.
NumberFormat.Field
,
AttributedCharacterIterator
,
NumberFormatter
public java.math.BigDecimal toBigDecimal()
NumberFormatter
@Deprecated public PluralRules.IFixedDecimal getFixedDecimal()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
Copyright ? 2016 Unicode, Inc. and others.