public
interface
FormattedValue
implements
CharSequence
android.icu.text.FormattedValue
|
Known indirect subclasses
|
An abstract formatted value: a string with associated field attributes.
Many formatters format to classes implementing FormattedValue.
Summary
Inherited methods |
From interface
java.lang.CharSequence
abstract
char
|
charAt(int index)
Returns the char value at the specified index.
|
default
IntStream
|
chars()
Returns a stream of int zero-extending the char values
from this sequence.
|
default
IntStream
|
codePoints()
Returns a stream of code point values from this sequence.
|
static
int
|
compare(CharSequence cs1, CharSequence cs2)
Compares two CharSequence instances lexicographically.
|
default
boolean
|
isEmpty()
Returns true if this character sequence is empty.
|
abstract
int
|
length()
Returns the length of this character sequence.
|
abstract
CharSequence
|
subSequence(int start, int end)
Returns a CharSequence that is a subsequence of this sequence.
|
abstract
String
|
toString()
Returns a string containing the characters in this sequence in the same
order as this sequence.
|
|
Public methods
appendTo
public abstract A appendTo (A appendable)
Appends the formatted string to an Appendable.
If an IOException occurs when appending to the Appendable, an unchecked
ICUUncheckedIOException
is thrown instead.
Parameters |
appendable |
A : The Appendable to which to append the string output. |
Returns |
A |
The same Appendable, for chaining. |
nextPosition
public abstract boolean nextPosition (ConstrainedFieldPosition cfpos)
Iterates over field positions in the FormattedValue. This lets you determine the position
of specific types of substrings, like a month or a decimal separator.
To loop over all field positions:
ConstrainedFieldPosition cfpos = new ConstrainedFieldPosition();
while (fmtval.nextPosition(cfpos)) {
// handle the field position; get information from cfpos
}
Returns |
boolean |
true if a new occurrence of the field was found;
false otherwise. |
toString
public abstract String toString ()
Returns the formatted string as a Java String.
Consider using appendTo(A)
for greater efficiency.
Returns |
String |
The formatted string. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[]]