CARVIEW |
Select Language
HTTP/2 200
server: GitHub.com
content-type: text/html; charset=utf-8
x-origin-cache: HIT
last-modified: Thu, 13 Mar 2025 20:00:10 GMT
access-control-allow-origin: *
etag: W/"67d3394a-41fe"
expires: Sat, 19 Jul 2025 20:41:29 GMT
cache-control: max-age=600
content-encoding: gzip
x-proxy-cache: MISS
x-github-request-id: 4B01:3A9CB5:B7BBD:E2944:687C00A0
accept-ranges: bytes
age: 0
date: Sat, 19 Jul 2025 20:31:29 GMT
via: 1.1 varnish
x-served-by: cache-bom4740-BOM
x-cache: MISS
x-cache-hits: 0
x-timer: S1752957089.910869,VS0,VE199
vary: Accept-Encoding
x-fastly-request-id: e2bfb452b0f584fbb5e9cb2be4e7d7b46c283c29
content-length: 3446
FormattedValue (ICU4J 77)
com.ibm.icu.text
Interface FormattedValue
-
- All Superinterfaces:
- CharSequence
- All Known Implementing Classes:
- DateIntervalFormat.FormattedDateInterval, FormattedMessage, FormattedNumber, FormattedNumberRange, ListFormatter.FormattedList, PlainStringFormattedValue, RelativeDateTimeFormatter.FormattedRelativeDateTime
public interface FormattedValue extends CharSequence
An abstract formatted value: a string with associated field attributes. Many formatters format to classes implementing FormattedValue.- Author:
- sffc
- Status:
- Stable ICU 64.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description <A extends Appendable>
AappendTo(A appendable)
Appends the formatted string to an Appendable.boolean
nextPosition(ConstrainedFieldPosition cfpos)
Iterates over field positions in the FormattedValue.AttributedCharacterIterator
toCharacterIterator()
Exports the formatted number as an AttributedCharacterIterator.String
toString()
Returns the formatted string as a Java String.-
Methods inherited from interface java.lang.CharSequence
charAt, chars, codePoints, length, subSequence
-
-
-
-
Method Detail
-
toString
String toString()
Returns the formatted string as a Java String. Consider usingappendTo(A)
for greater efficiency.- Specified by:
toString
in interfaceCharSequence
- Overrides:
toString
in classObject
- Returns:
- The formatted string.
- Status:
- Stable ICU 64.
-
appendTo
<A extends Appendable> 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
- The Appendable to which to append the string output.- Returns:
- The same Appendable, for chaining.
- Throws:
ICUUncheckedIOException
- if the Appendable throws IOException- Status:
- Stable ICU 64.
-
nextPosition
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 }
- Parameters:
cfpos
- The object used for iteration state. This can provide constraints to iterate over only one specific field; seeConstrainedFieldPosition.constrainField(java.text.Format.Field)
.- Returns:
- true if a new occurrence of the field was found; false otherwise.
- Status:
- Stable ICU 64.
-
toCharacterIterator
AttributedCharacterIterator toCharacterIterator()
Exports the formatted number as an AttributedCharacterIterator.Consider using
nextPosition(com.ibm.icu.text.ConstrainedFieldPosition)
if you are trying to get field information.- Returns:
- An AttributedCharacterIterator containing full field information.
- Status:
- Stable ICU 64.
-
-
Copyright © 2016 Unicode, Inc. and others.