Freigeben über


NumberFormatterSettings.RoundingMode(RoundingMode) Method

Definition

Specifies how to determine the direction to round a number when it has more digits than fit in the desired precision.

[Android.Runtime.Register("roundingMode", "(Ljava/math/RoundingMode;)Landroid/icu/number/NumberFormatterSettings;", "GetRoundingMode_Ljava_math_RoundingMode_Handler", ApiSince=30)]
public virtual Java.Lang.Object? RoundingMode (Java.Math.RoundingMode? roundingMode);
[<Android.Runtime.Register("roundingMode", "(Ljava/math/RoundingMode;)Landroid/icu/number/NumberFormatterSettings;", "GetRoundingMode_Ljava_math_RoundingMode_Handler", ApiSince=30)>]
abstract member RoundingMode : Java.Math.RoundingMode -> Java.Lang.Object
override this.RoundingMode : Java.Math.RoundingMode -> Java.Lang.Object

Parameters

roundingMode
RoundingMode

The rounding mode to use.

Returns

The fluent chain.

Attributes

Remarks

Specifies how to determine the direction to round a number when it has more digits than fit in the desired precision. When formatting 1.235:

<ul> <li>Ceiling rounding mode with integer precision: "2" <li>Half-down rounding mode with 2 fixed fraction digits: "1.23" <li>Half-up rounding mode with 2 fixed fraction digits: "1.24" </ul>

The default is HALF_EVEN. For more information on rounding mode, see the ICU userguide here:

https://unicode-org.github.io/icu/userguide/format_parse/numbers/rounding-modes

Java documentation for android.icu.number.NumberFormatterSettings.roundingMode(java.math.RoundingMode).

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