다음을 통해 공유


DecimalFormat.Format Method

Definition

Overloads

Format(Object, StringBuffer, FieldPosition)

Formats a number and appends the resulting text to the given string buffer.

Format(Double, StringBuffer, FieldPosition)

Formats a double to produce a string.

Format(Int64, StringBuffer, FieldPosition)

Format a long to produce a string.

Format(Object, StringBuffer, FieldPosition)

Formats a number and appends the resulting text to the given string buffer.

[Android.Runtime.Register("format", "(Ljava/lang/Object;Ljava/lang/StringBuffer;Ljava/text/FieldPosition;)Ljava/lang/StringBuffer;", "")]
public override sealed Java.Lang.StringBuffer? Format (Java.Lang.Object? number, Java.Lang.StringBuffer? toAppendTo, Java.Text.FieldPosition? pos);
[<Android.Runtime.Register("format", "(Ljava/lang/Object;Ljava/lang/StringBuffer;Ljava/text/FieldPosition;)Ljava/lang/StringBuffer;", "")>]
override this.Format : Java.Lang.Object * Java.Lang.StringBuffer * Java.Text.FieldPosition -> Java.Lang.StringBuffer

Parameters

number
Object

the number to format

toAppendTo
StringBuffer

the StringBuffer to which the formatted text is to be appended

pos
FieldPosition

keeps track on the position of the field within the returned string. For example, for formatting a number 1234567.89 in Locale.US locale, if the given fieldPosition is NumberFormat#INTEGER_FIELD, the begin index and end index of fieldPosition will be set to 0 and 9, respectively for the output string 1,234,567.89.

Returns

the value passed in as toAppendTo

Attributes

Remarks

Formats a number and appends the resulting text to the given string buffer. The number can be of any subclass of java.lang.Number.

This implementation uses the maximum precision permitted.

Java documentation for java.text.DecimalFormat.format(java.lang.Object, java.lang.StringBuffer, java.text.FieldPosition).

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

Format(Double, StringBuffer, FieldPosition)

Formats a double to produce a string.

[Android.Runtime.Register("format", "(DLjava/lang/StringBuffer;Ljava/text/FieldPosition;)Ljava/lang/StringBuffer;", "GetFormat_DLjava_lang_StringBuffer_Ljava_text_FieldPosition_Handler")]
public override Java.Lang.StringBuffer? Format (double number, Java.Lang.StringBuffer? result, Java.Text.FieldPosition? fieldPosition);
[<Android.Runtime.Register("format", "(DLjava/lang/StringBuffer;Ljava/text/FieldPosition;)Ljava/lang/StringBuffer;", "GetFormat_DLjava_lang_StringBuffer_Ljava_text_FieldPosition_Handler")>]
override this.Format : double * Java.Lang.StringBuffer * Java.Text.FieldPosition -> Java.Lang.StringBuffer

Parameters

number
Double

The double to format

result
StringBuffer

where the text is to be appended

fieldPosition
FieldPosition

keeps track on the position of the field within the returned string. For example, for formatting a number 1234567.89 in Locale.US locale, if the given fieldPosition is NumberFormat#INTEGER_FIELD, the begin index and end index of fieldPosition will be set to 0 and 9, respectively for the output string 1,234,567.89.

Returns

The formatted number string

Attributes

Remarks

Formats a double to produce a string.

Java documentation for java.text.DecimalFormat.format(double, java.lang.StringBuffer, java.text.FieldPosition).

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

Format(Int64, StringBuffer, FieldPosition)

Format a long to produce a string.

[Android.Runtime.Register("format", "(JLjava/lang/StringBuffer;Ljava/text/FieldPosition;)Ljava/lang/StringBuffer;", "GetFormat_JLjava_lang_StringBuffer_Ljava_text_FieldPosition_Handler")]
public override Java.Lang.StringBuffer? Format (long number, Java.Lang.StringBuffer? result, Java.Text.FieldPosition? fieldPosition);
[<Android.Runtime.Register("format", "(JLjava/lang/StringBuffer;Ljava/text/FieldPosition;)Ljava/lang/StringBuffer;", "GetFormat_JLjava_lang_StringBuffer_Ljava_text_FieldPosition_Handler")>]
override this.Format : int64 * Java.Lang.StringBuffer * Java.Text.FieldPosition -> Java.Lang.StringBuffer

Parameters

number
Int64

The long to format

result
StringBuffer

where the text is to be appended

fieldPosition
FieldPosition

keeps track on the position of the field within the returned string. For example, for formatting a number 123456789 in Locale.US locale, if the given fieldPosition is NumberFormat#INTEGER_FIELD, the begin index and end index of fieldPosition will be set to 0 and 11, respectively for the output string 123,456,789.

Returns

The formatted number string

Attributes

Remarks

Format a long to produce a string.

Java documentation for java.text.DecimalFormat.format(long, java.lang.StringBuffer, java.text.FieldPosition).

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