public class FormattedNumber extends java.lang.Object implements FormattedValue
NumberFormatter| Modifier and Type | Method and Description |
|---|---|
<A extends java.lang.Appendable> |
appendTo(A appendable)
Appends the formatted string to an Appendable.
|
char |
charAt(int index) |
PluralRules.IFixedDecimal |
getFixedDecimal()
Deprecated.
This API is ICU internal only.
|
java.lang.String |
getGender()
Deprecated.
This API is for technology preview only.
|
DisplayOptions.NounClass |
getNounClass()
Gets the noun class of the formatted output.
|
MeasureUnit |
getOutputUnit()
Gets the resolved output unit.
|
int |
length() |
boolean |
nextPosition(ConstrainedFieldPosition cfpos)
Iterates over field positions in the FormattedValue.
|
java.lang.CharSequence |
subSequence(int start,
int end) |
java.math.BigDecimal |
toBigDecimal()
Export the formatted number as a BigDecimal.
|
java.text.AttributedCharacterIterator |
toCharacterIterator()
Exports the formatted number as an AttributedCharacterIterator.
|
java.lang.String |
toString()
Returns the formatted string as a Java String.
|
public java.lang.String toString()
FormattedValue.appendTo(A) for greater efficiency.toString in interface FormattedValuetoString in interface java.lang.CharSequencetoString in class java.lang.Objectpublic int length()
length in interface java.lang.CharSequencepublic char charAt(int index)
charAt in interface java.lang.CharSequencepublic java.lang.CharSequence subSequence(int start,
int end)
subSequence in interface java.lang.CharSequencepublic <A extends java.lang.Appendable> A appendTo(A appendable)
If an IOException occurs when appending to the Appendable, an unchecked
ICUUncheckedIOException is thrown instead.
appendTo in interface FormattedValueappendable - The Appendable to which to append the string output.public boolean nextPosition(ConstrainedFieldPosition cfpos)
ConstrainedFieldPosition cfpos = new ConstrainedFieldPosition();
while (fmtval.nextPosition(cfpos)) {
// handle the field position; get information from cfpos
}
nextPosition in interface FormattedValuecfpos - The object used for iteration state. This can provide constraints to iterate over
only one specific field; see ConstrainedFieldPosition.constrainField(java.text.Format.Field).public java.text.AttributedCharacterIterator toCharacterIterator()
Consider using FormattedValue.nextPosition(com.ibm.icu.text.ConstrainedFieldPosition) if you are trying to get field information.
toCharacterIterator in interface FormattedValuepublic java.math.BigDecimal toBigDecimal()
NumberFormatterpublic MeasureUnit getOutputUnit()
The output unit is dependent upon the localized preferences for the usage specified via NumberFormatterSettings.usage(), and may be a unit with MeasureUnit.Complexity.MIXED unit complexity (MeasureUnit.getComplexity()), such as "foot-and-inch" or "hour-and-minute-and-second".
MeasureUnit.public DisplayOptions.NounClass getNounClass()
UNDEFINED when the noun class is not
supported yet.@Deprecated public java.lang.String getGender()
@Deprecated public PluralRules.IFixedDecimal getFixedDecimal()
Copyright ? 2016 Unicode, Inc. and others.