Skip to content

Type Property

compactName

iOS 15.0+ iPadOS 15.0+ Mac Catalyst 15.0+ macOS 12.0+ tvOS 15.0+ watchOS 8.0+
A locale-appropriate compact name notation.
static var compactName: NumberFormatStyleConfiguration.Notation { get }

Discussion

A compact name notation, when available in the format style’s locale, that uses prefixes or suffixes corresponding to powers of ten. The following example shows a compact name notation in the fr_FR locale:

let compactNameFormatted = 1234.formatted(.number
    .locale(Locale(identifier: "fr_FR"))
    .notation(.compactName)) // "1,2 k"

Note

We do not support parsing a number string containing localized prefixes or suffixes.