# UFormat

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# UFormat

*** ** * ** ***

Kotlin \|[Java](https://developer.android.com/reference/android/icu/text/UFormat "View this page in Java")  

```
abstract class UFormat : Format
```

|---|---|------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                          |||
| ↳ | [java.text.Format](https://developer.android.com/reference/kotlin/java/text/Format.html#)               ||
|   | ↳ | [android.icu.text.UFormat](https://developer.android.com/reference/kotlin/android/icu/text/UFormat#) |

|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Known Direct Subclasses [DateFormat](https://developer.android.com/reference/kotlin/android/icu/text/DateFormat), [DateIntervalFormat](https://developer.android.com/reference/kotlin/android/icu/text/DateIntervalFormat), [MeasureFormat](https://developer.android.com/reference/kotlin/android/icu/text/MeasureFormat), [MessageFormat](https://developer.android.com/reference/kotlin/android/icu/text/MessageFormat), [NumberFormat](https://developer.android.com/reference/kotlin/android/icu/text/NumberFormat), [PluralFormat](https://developer.android.com/reference/kotlin/android/icu/text/PluralFormat), [TimeZoneFormat](https://developer.android.com/reference/kotlin/android/icu/text/TimeZoneFormat) |----------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------| | [DateFormat](https://developer.android.com/reference/kotlin/android/icu/text/DateFormat)                 | **\[icu enhancement\]** ICU's replacement for [java.text.DateFormat](https://developer.android.com/reference/kotlin/java/text/DateFormat.html#).       | | [DateIntervalFormat](https://developer.android.com/reference/kotlin/android/icu/text/DateIntervalFormat) | DateIntervalFormat is a class for formatting and parsing date intervals in a language-independent manner.                                              | | [MeasureFormat](https://developer.android.com/reference/kotlin/android/icu/text/MeasureFormat)           | A formatter for Measure objects.                                                                                                                       | | [MessageFormat](https://developer.android.com/reference/kotlin/android/icu/text/MessageFormat)           | **\[icu enhancement\]** ICU's replacement for [java.text.MessageFormat](https://developer.android.com/reference/kotlin/java/text/MessageFormat.html#). | | [NumberFormat](https://developer.android.com/reference/kotlin/android/icu/text/NumberFormat)             | **\[icu enhancement\]** ICU's replacement for [java.text.NumberFormat](https://developer.android.com/reference/kotlin/java/text/NumberFormat.html#).   | | [PluralFormat](https://developer.android.com/reference/kotlin/android/icu/text/PluralFormat)             | `PluralFormat` supports the creation of internationalized messages with plural inflection.                                                             | | [TimeZoneFormat](https://developer.android.com/reference/kotlin/android/icu/text/TimeZoneFormat)         | `TimeZoneFormat` supports time zone display name formatting and parsing.                                                                               | |

|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Known Indirect Subclasses [CompactDecimalFormat](https://developer.android.com/reference/kotlin/android/icu/text/CompactDecimalFormat), [DecimalFormat](https://developer.android.com/reference/kotlin/android/icu/text/DecimalFormat), [SimpleDateFormat](https://developer.android.com/reference/kotlin/android/icu/text/SimpleDateFormat) |--------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------| | [CompactDecimalFormat](https://developer.android.com/reference/kotlin/android/icu/text/CompactDecimalFormat) | Formats numbers in compact (abbreviated) notation, like "1.                                                                                                  | | [DecimalFormat](https://developer.android.com/reference/kotlin/android/icu/text/DecimalFormat)               | **\[icu enhancement\]** ICU's replacement for [java.text.DecimalFormat](https://developer.android.com/reference/kotlin/java/text/DecimalFormat.html#).       | | [SimpleDateFormat](https://developer.android.com/reference/kotlin/android/icu/text/SimpleDateFormat)         | **\[icu enhancement\]** ICU's replacement for [java.text.SimpleDateFormat](https://developer.android.com/reference/kotlin/java/text/SimpleDateFormat.html#). | |

An abstract class that extends [java.text.Format](https://developer.android.com/reference/kotlin/java/text/Format.html#) to provide additional ICU protocol, specifically, the getLocale() API. All ICU format classes are subclasses of this class.

## Summary

|                                                   Public constructors                                                    ||
|-----------------------------------------------------------------------------------------------------------------------|---|
| [UFormat](https://developer.android.com/reference/kotlin/android/icu/text/UFormat#UFormat())`()` Default constructor. |

| Inherited functions ||
|---|---|
| From class [Format](https://developer.android.com/reference/kotlin/java/text/Format.html#) |----------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                 | [clone](https://developer.android.com/reference/kotlin/java/text/Format.html#clone())`()` Creates and returns a copy of this object. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!                                          | [format](https://developer.android.com/reference/kotlin/java/text/Format.html#format(kotlin.Any))`(`obj:` `[Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)!`)` Formats an object to produce a string. This is equivalent to [format](https://developer.android.com/reference/kotlin/java/text/Format.html#format(kotlin.Any,%20java.lang.StringBuffer,%20java.text.FieldPosition))`(obj, new StringBuffer(), new FieldPosition(0)).toString();` <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | | [StringBuffer](https://developer.android.com/reference/kotlin/java/lang/StringBuffer.html#)!                               | [format](https://developer.android.com/reference/kotlin/java/text/Format.html#format(kotlin.Any,%20java.lang.StringBuffer,%20java.text.FieldPosition))`(`obj:` `[Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)!`, `toAppendTo:` `[StringBuffer](https://developer.android.com/reference/kotlin/java/lang/StringBuffer.html#)!`, `pos:` `[FieldPosition](https://developer.android.com/reference/kotlin/java/text/FieldPosition.html#)!`)` Formats an object and appends the resulting text to a given string buffer. If the `pos` argument identifies a field used by the format, then its indices are set to the beginning and end of the first such field encountered. <br />                                                                                                                                                                                                                                                                      | | [AttributedCharacterIterator](https://developer.android.com/reference/kotlin/java/text/AttributedCharacterIterator.html#)! | [formatToCharacterIterator](https://developer.android.com/reference/kotlin/java/text/Format.html#formatToCharacterIterator(kotlin.Any))`(`obj:` `[Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)!`)` Formats an Object producing an `AttributedCharacterIterator`. You can use the returned `AttributedCharacterIterator` to build the resulting String, as well as to determine information about the resulting String. Each attribute key of the AttributedCharacterIterator will be of type `Field`. It is up to each `Format` implementation to define what the legal values are for each attribute in the `AttributedCharacterIterator`, but typically the attribute key is also used as the attribute value. The default implementation creates an `AttributedCharacterIterator` with no attributes. Subclasses that support fields should override this and create an `AttributedCharacterIterator` with meaningful attributes. <br />         | | [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)!                                                | [parseObject](https://developer.android.com/reference/kotlin/java/text/Format.html#parseObject(kotlin.String))`(`source:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` Parses text from the beginning of the given string to produce an object. The method may not use the entire text of the given string. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | | [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)!                                                | [parseObject](https://developer.android.com/reference/kotlin/java/text/Format.html#parseObject(kotlin.String,%20java.text.ParsePosition))`(`source:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`, `pos:` `[ParsePosition](https://developer.android.com/reference/kotlin/java/text/ParsePosition.html#)!`)` Parses text from a string to produce an object. The method attempts to parse text starting at the index given by `pos`. If parsing succeeds, then the index of `pos` is updated to the index after the last character used (parsing does not necessarily use all characters up to the end of the string), and the parsed object is returned. The updated `pos` can be used to indicate the starting point for the next call to this method. If an error occurs, then the index of `pos` is not changed, the error index of `pos` is set to the index of the character where the error occurred, and null is returned. <br /> | ||

## Public constructors

### UFormat

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
UFormat()
```

Default constructor.