Język

NumberFormatterSettings.Grouping(NumberFormatter+GroupingStrategy) Method

Definition

Specifies the grouping strategy to use when formatting numbers.

[Android.Runtime.Register("grouping", "(Landroid/icu/number/NumberFormatter$GroupingStrategy;)Landroid/icu/number/NumberFormatterSettings;", "GetGrouping_Landroid_icu_number_NumberFormatter_GroupingStrategy_Handler", ApiSince=30)]
public virtual Java.Lang.Object? Grouping(Android.Icu.Number.NumberFormatter.GroupingStrategy? strategy);
[<Android.Runtime.Register("grouping", "(Landroid/icu/number/NumberFormatter$GroupingStrategy;)Landroid/icu/number/NumberFormatterSettings;", "GetGrouping_Landroid_icu_number_NumberFormatter_GroupingStrategy_Handler", ApiSince=30)>]
abstract member Grouping : Android.Icu.Number.NumberFormatter.GroupingStrategy -> Java.Lang.Object
override this.Grouping : Android.Icu.Number.NumberFormatter.GroupingStrategy -> Java.Lang.Object

Parameters

strategy
NumberFormatter.GroupingStrategy

The grouping strategy to use.

Returns

The fluent chain.

Attributes

Remarks

Specifies the grouping strategy to use when formatting numbers.

Default grouping: "12,300" and "1,230"

Grouping with at least 2 digits: "12,300" and "1230"

No grouping: "12300" and "1230"

The exact grouping widths will be chosen based on the locale.

Pass this method an element from the GroupingStrategy enum.

NumberFormatter.with().grouping(GroupingStrategy.MIN2)

The default is to perform grouping according to locale data; most locales, but not all locales, enable it by default.

Android reference for android.icu.number.NumberFormatterSettings.grouping.

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