Partager via


FractionPrecision.WithMaxDigits(Int32) Method

Definition

Ensure that no more than this number of significant digits are retained when rounding according to fraction rules.

[Android.Runtime.Register("withMaxDigits", "(I)Landroid/icu/number/Precision;", "GetWithMaxDigits_IHandler", ApiSince=30)]
public virtual Android.Icu.Number.Precision? WithMaxDigits (int maxSignificantDigits);
[<Android.Runtime.Register("withMaxDigits", "(I)Landroid/icu/number/Precision;", "GetWithMaxDigits_IHandler", ApiSince=30)>]
abstract member WithMaxDigits : int -> Android.Icu.Number.Precision
override this.WithMaxDigits : int -> Android.Icu.Number.Precision

Parameters

maxSignificantDigits
Int32

Round the number to no more than this number of significant figures.

Returns

A Precision for chaining or passing to the NumberFormatter rounding() setter.

Attributes

Remarks

Ensure that no more than this number of significant digits are retained when rounding according to fraction rules.

For example, with integer rounding, the number 123.4 becomes "123". However, with maximum figures set to 2, 123.4 becomes "120" instead.

This setting does not affect the number of trailing zeros. For example, with fixed fraction of 2, 123.4 would become "120.00".

This is equivalent to withSignificantDigits(1, maxSignificantDigits, STRICT).

Java documentation for android.icu.number.FractionPrecision.withMaxDigits(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