DecimalFormat.ApplyPattern(String) Method

Definition

Apply the given pattern to this Format object.

[Android.Runtime.Register("applyPattern", "(Ljava/lang/String;)V", "GetApplyPattern_Ljava_lang_String_Handler")]
public virtual void ApplyPattern (string? pattern);
[<Android.Runtime.Register("applyPattern", "(Ljava/lang/String;)V", "GetApplyPattern_Ljava_lang_String_Handler")>]
abstract member ApplyPattern : string -> unit
override this.ApplyPattern : string -> unit

Parameters

pattern
String

a new pattern

Attributes

Exceptions

if the pattern cannot be parsed.

Remarks

Apply the given pattern to this Format object. A pattern is a short-hand specification for the various formatting properties. These properties can also be changed individually through the various setter methods.

There is no limit to integer digits set by this routine, since that is the typical end-user desire; use setMaximumInteger if you want to set a real value. For negative numbers, use a second pattern, separated by a semicolon

Example "#,#00.0#" &rarr; 1,234.56

This means a minimum of 2 integer digits, 1 fraction digit, and a maximum of 2 fraction digits.

Example: "#,#00.0#;(#,#00.0#)" for negatives in parentheses.

In negative patterns, the minimum and maximum counts are ignored; these are presumed to be set in the positive pattern.

Java documentation for java.text.DecimalFormat.applyPattern(java.lang.String).

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