Compartir a través de


Notation.CompactShort Method

Definition

Print the number using short-form compact notation.

[Android.Runtime.Register("compactShort", "()Landroid/icu/number/CompactNotation;", "", ApiSince=30)]
public static Android.Icu.Number.CompactNotation? CompactShort ();
[<Android.Runtime.Register("compactShort", "()Landroid/icu/number/CompactNotation;", "", ApiSince=30)>]
static member CompactShort : unit -> Android.Icu.Number.CompactNotation

Returns

A CompactNotation for passing to the NumberFormatter notation() setter.

Attributes

Remarks

Print the number using short-form compact notation.

<em>Compact notation</em>, defined in Unicode Technical Standard #35 Part 3 Section 2.4.1, prints numbers with localized prefixes or suffixes corresponding to different powers of ten. Compact notation is similar to engineering notation in how it scales numbers.

Compact notation is ideal for displaying large numbers (over ~1000) to humans while at the same time minimizing screen real estate.

In short form, the powers of ten are abbreviated. In <em>en-US</em>, the abbreviations are "K" for thousands, "M" for millions, "B" for billions, and "T" for trillions. Example outputs in <em>en-US</em> when printing 8.765E7 through 8.765E0:

88M
            8.8M
            876K
            88K
            8.8K
            876
            88
            8.8

When compact notation is specified without an explicit rounding strategy, numbers are rounded off to the closest integer after scaling the number by the corresponding power of 10, but with a digit shown after the decimal separator if there is only one digit before the decimal separator. The default compact notation rounding strategy is equivalent to:

Rounder.integer().withMinDigits(2)

Java documentation for android.icu.number.Notation.compactShort().

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