Udostępnij za pośrednictwem


IFormattable.FormatTo(Formatter, FormatFlags, Int32, Int32) Method

Definition

Formats the object using the provided Formatter formatter.

[Android.Runtime.Register("formatTo", "(Ljava/util/Formatter;III)V", "GetFormatTo_Ljava_util_Formatter_IIIHandler:Java.Util.IFormattableInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public void FormatTo (Java.Util.Formatter? formatter, Java.Util.FormatFlags flags, int width, int precision);
[<Android.Runtime.Register("formatTo", "(Ljava/util/Formatter;III)V", "GetFormatTo_Ljava_util_Formatter_IIIHandler:Java.Util.IFormattableInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member FormatTo : Java.Util.Formatter * Java.Util.FormatFlags * int * int -> unit

Parameters

formatter
Formatter

The Formatter formatter. Implementing classes may call Formatter#out() formatter.out() or Formatter#locale() formatter.locale() to obtain the Appendable or Locale used by this formatter respectively.

flags
FormatFlags

The flags modify the output format. The value is interpreted as a bitmask. Any combination of the following flags may be set: FormattableFlags#LEFT_JUSTIFY, FormattableFlags#UPPERCASE, and FormattableFlags#ALTERNATE. If no flags are set, the default formatting of the implementing class will apply.

width
Int32

The minimum number of characters to be written to the output. If the length of the converted value is less than the width then the output will be padded by '&nbsp;&nbsp;' until the total number of characters equals width. The padding is at the beginning by default. If the FormattableFlags#LEFT_JUSTIFY flag is set then the padding will be at the end. If width is -1 then there is no minimum.

precision
Int32

The maximum number of characters to be written to the output. The precision is applied before the width, thus the output will be truncated to precision characters even if the width is greater than the precision. If precision is -1 then there is no explicit limit on the number of characters.

Attributes

Exceptions

if any of the parameters is not supported.

Remarks

Formats the object using the provided Formatter formatter.

Java documentation for java.util.Formattable.formatTo(java.util.Formatter, int, int, int).

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