public class FormattedNumberRange
extends java.lang.Object
NumberRangeFormatter
Modifier and Type | Method and Description |
---|---|
<A extends java.lang.Appendable> |
appendTo(A appendable)
Append the formatted number range to an Appendable, such as a StringBuilder.
|
boolean |
equals(java.lang.Object other) |
java.math.BigDecimal |
getFirstBigDecimal()
Export the first formatted number as a BigDecimal.
|
NumberRangeFormatter.RangeIdentityResult |
getIdentityResult()
Returns whether the pair of numbers was successfully formatted as a range or whether an identity fallback was
used.
|
java.math.BigDecimal |
getSecondBigDecimal()
Export the second formatted number as a BigDecimal.
|
int |
hashCode() |
boolean |
nextFieldPosition(java.text.FieldPosition fieldPosition)
Determines the start (inclusive) and end (exclusive) indices of the next occurrence of the given
field in the output string.
|
java.text.AttributedCharacterIterator |
toCharacterIterator()
Export the formatted number range as an AttributedCharacterIterator.
|
java.lang.String |
toString()
Creates a String representation of the the formatted number range.
|
public java.lang.String toString()
toString
in class java.lang.Object
NumberRangeFormatter
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 range string.Appendable
,
NumberRangeFormatter
public boolean nextFieldPosition(java.text.FieldPosition fieldPosition)
If both sides of the range have the same field, the field will occur twice, once before the range separator and once after the range separator, if applicable.
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.INTEGER); while (formattedNumberRange.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. See FormattedNumber.nextFieldPosition(FieldPosition)
.NumberFormat.Field
,
NumberRangeFormatter
public java.text.AttributedCharacterIterator toCharacterIterator()
If information on only one field is needed, use nextFieldPosition(FieldPosition)
instead.
NumberFormat.Field
,
AttributedCharacterIterator
,
NumberRangeFormatter
public java.math.BigDecimal getFirstBigDecimal()
NumberRangeFormatter
,
getSecondBigDecimal()
public java.math.BigDecimal getSecondBigDecimal()
NumberRangeFormatter
,
getFirstBigDecimal()
public NumberRangeFormatter.RangeIdentityResult getIdentityResult()
NumberRangeFormatter
,
NumberRangeFormatter.RangeIdentityFallback
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.