Partager via


CurrencyPrecision.WithCurrency(Currency) Method

Definition

Associates a currency with this rounding strategy.

[Android.Runtime.Register("withCurrency", "(Landroid/icu/util/Currency;)Landroid/icu/number/Precision;", "GetWithCurrency_Landroid_icu_util_Currency_Handler", ApiSince=30)]
public virtual Android.Icu.Number.Precision? WithCurrency (Android.Icu.Util.Currency? currency);
[<Android.Runtime.Register("withCurrency", "(Landroid/icu/util/Currency;)Landroid/icu/number/Precision;", "GetWithCurrency_Landroid_icu_util_Currency_Handler", ApiSince=30)>]
abstract member WithCurrency : Android.Icu.Util.Currency -> Android.Icu.Number.Precision
override this.WithCurrency : Android.Icu.Util.Currency -> Android.Icu.Number.Precision

Parameters

currency
Currency

The currency to associate with this rounding strategy.

Returns

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

Attributes

Remarks

Associates a currency with this rounding strategy.

<strong>Calling this method is <em>not required</em></strong>, because the currency specified in unit() or via a CurrencyAmount passed into format(Measure) is automatically applied to currency rounding strategies. However, this method enables you to override that automatic association.

This method also enables numbers to be formatted using currency rounding rules without explicitly using a currency format.

Java documentation for android.icu.number.CurrencyPrecision.withCurrency(android.icu.util.Currency).

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