Partager via


MessageFormat.GetFormats Method

Definition

Returns the Format objects used for the format elements in the previously set pattern string.

[Android.Runtime.Register("getFormats", "()[Ljava/text/Format;", "GetGetFormatsHandler", ApiSince=24)]
public virtual Java.Text._Format[]? GetFormats ();
[<Android.Runtime.Register("getFormats", "()[Ljava/text/Format;", "GetGetFormatsHandler", ApiSince=24)>]
abstract member GetFormats : unit -> Java.Text._Format[]
override this.GetFormats : unit -> Java.Text._Format[]

Returns

the formats used for the format elements in the pattern

Attributes

Remarks

Returns the Format objects used for the format elements in the previously set pattern string. The order of formats in the returned array corresponds to the order of format elements in the pattern string.

Since the order of format elements in a pattern string often changes during localization, it's generally better to use the #getFormatsByArgumentIndex() method, which assumes an order of formats corresponding to the order of elements in the arguments array passed to the format methods or the result array returned by the parse methods.

This method is only supported when exclusively numbers are used for argument names. Otherwise an IllegalArgumentException is thrown.

Java documentation for android.icu.text.MessageFormat.getFormats().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to