다음을 통해 공유


MessageFormat.SetFormatByArgumentIndex(Int32, _Format) Method

Definition

Sets the Format object to use for the format elements within the previously set pattern string that use the given argument index.

[Android.Runtime.Register("setFormatByArgumentIndex", "(ILjava/text/Format;)V", "GetSetFormatByArgumentIndex_ILjava_text_Format_Handler", ApiSince=24)]
public virtual void SetFormatByArgumentIndex (int argumentIndex, Java.Text._Format? newFormat);
[<Android.Runtime.Register("setFormatByArgumentIndex", "(ILjava/text/Format;)V", "GetSetFormatByArgumentIndex_ILjava_text_Format_Handler", ApiSince=24)>]
abstract member SetFormatByArgumentIndex : int * Java.Text._Format -> unit
override this.SetFormatByArgumentIndex : int * Java.Text._Format -> unit

Parameters

argumentIndex
Int32

the argument index for which to use the new format

newFormat
_Format

the new format to use

Attributes

Remarks

Sets the Format object to use for the format elements within the previously set pattern string that use the given argument index. The argument index is part of the format element definition and represents an index into the arguments array passed to the format methods or the result array returned by the parse methods.

If the argument index is used for more than one format element in the pattern string, then the new format is used for all such format elements. If the argument index is not used for any format element in the pattern string, then the new format is ignored.

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.setFormatByArgumentIndex(int, java.text.Format).

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