DecimalFormat.DecimalPatternMatchRequired Property

Definition

<strong>[icu]</strong> Returns whether the presence of a decimal point must match the pattern. -or- <strong>[icu]</strong> <strong>Parsing:</strong> This method is used to either <em>require</em> or <em>forbid</em> the presence of a decimal point in the string being parsed (disabled by default).

public virtual bool DecimalPatternMatchRequired { [Android.Runtime.Register("isDecimalPatternMatchRequired", "()Z", "GetIsDecimalPatternMatchRequiredHandler", ApiSince=24)] get; [Android.Runtime.Register("setDecimalPatternMatchRequired", "(Z)V", "GetSetDecimalPatternMatchRequired_ZHandler", ApiSince=24)] set; }
[<get: Android.Runtime.Register("isDecimalPatternMatchRequired", "()Z", "GetIsDecimalPatternMatchRequiredHandler", ApiSince=24)>]
[<set: Android.Runtime.Register("setDecimalPatternMatchRequired", "(Z)V", "GetSetDecimalPatternMatchRequired_ZHandler", ApiSince=24)>]
member this.DecimalPatternMatchRequired : bool with get, set

Property Value

Attributes

Remarks

Property getter documentation:

<strong>[icu]</strong> Returns whether the presence of a decimal point must match the pattern.

Java documentation for android.icu.text.DecimalFormat.isDecimalPatternMatchRequired().

Property setter documentation:

<strong>[icu]</strong> <strong>Parsing:</strong> This method is used to either <em>require</em> or <em>forbid</em> the presence of a decimal point in the string being parsed (disabled by default). This feature was designed to be an extra layer of strictness on top of strict parsing, although it can be used in either lenient mode or strict mode.

To <em>require</em> a decimal point, call this method in combination with either a pattern containing a decimal point or with #setDecimalSeparatorAlwaysShown.

// Require a decimal point in the string being parsed:
            df.applyPattern("#.");
            df.setDecimalPatternMatchRequired(true);

            // Alternatively:
            df.setDecimalSeparatorAlwaysShown(true);
            df.setDecimalPatternMatchRequired(true);

To <em>forbid</em> a decimal point, call this method in combination with a pattern containing no decimal point. Alternatively, use #setParseIntegerOnly for the same behavior without depending on the contents of the pattern string.

// Forbid a decimal point in the string being parsed:
            df.applyPattern("#");
            df.setDecimalPatternMatchRequired(true);

Java documentation for android.icu.text.DecimalFormat.setDecimalPatternMatchRequired(boolean).

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