One Logo Pool Ball
Foundation · IOS API REFERENCE

Decimal.FormatStyle.Percent

struct · iOS 15.0+ · SDK 27.1

struct Percent

A format style that converts between decimal percentage values and their textual representations.

Members (15)

get · iOS 15.0+

attributed

TypeScript
get attributed(): Decimal_FormatStyle_Attributed
Swift declaration
var attributed: Decimal.FormatStyle.Attributed { get }

An attributed format style based on the decimal percent format style. Use this modifier to create a ``Decimal/FormatStyle/Attributed`` instance, which formats values as ``AttributedString`` instances. These attributed strings contain attributes from the ``AttributeScopes/FoundationAttributes/NumberFormatAttributes`` attribute scope. Use these attributes to determine which runs of the attributed string represent different parts of the formatted value.

get · iOS 15.0+

parseStrategy

TypeScript
get parseStrategy(): Decimal_ParseStrategy<Decimal_FormatStyle_Percent>
Swift declaration
var parseStrategy: Decimal.ParseStrategy<Decimal.FormatStyle.Percent> { get }

The parse strategy that this format style uses.

method · iOS 15.0+

decimalSeparator

TypeScript
decimalSeparator(strategy: NumberFormatStyleConfiguration_DecimalSeparatorDisplayStrategy): Decimal_FormatStyle_Percent
Swift declaration
func decimalSeparator(strategy: Decimal.FormatStyle.Percent.Configuration.DecimalSeparatorDisplayStrategy) -> Decimal.FormatStyle.Percent

Modifies the format style to use the specified decimal separator display strategy. - Parameter strategy: The decimal separator display strategy to apply to the format style. - Returns: A decimal percent format style modified to use the specified decimal separator display strategy.

method · iOS 15.0+

sign

TypeScript
sign(strategy: NumberFormatStyleConfiguration_SignDisplayStrategy): Decimal_FormatStyle_Percent
Swift declaration
func sign(strategy: Decimal.FormatStyle.Percent.Configuration.SignDisplayStrategy) -> Decimal.FormatStyle.Percent

Modifies the format style to use the specified sign display strategy for displaying or omitting sign symbols. - Parameter strategy: The sign display strategy to apply to the format style. - Returns: A decimal percent format style modified to use the specified sign display strategy.

method · iOS 15.0+

scale

TypeScript
scale(multiplicand: number): Decimal_FormatStyle_Percent
Swift declaration
func scale(_ multiplicand: Double) -> Decimal.FormatStyle.Percent

Modifies the format style to use the specified scale. - Parameter multiplicand: The multiplicand to apply to the format style. - Returns: A decimal percent format style modified to use the specified scale.

method · iOS 15.0+

format

TypeScript
format(value: Decimal): string
Swift declaration
func format(_ value: Decimal) -> String

Formats a decimal value as a percentage, using this style. - Parameter value: The decimal value to format. - Returns: A string representation of `value` formatted as a percentage according to the style's configuration.

get · iOS 15.0+

locale

TypeScript
get locale(): Locale
Swift declaration
var locale: Locale

The locale of the format style. Use the ``locale(_:)`` modifier to create a copy of this format style with a different locale.

set · iOS 15.0+

locale

TypeScript
set locale(value: Locale)
Swift declaration
var locale: Locale

The locale of the format style. Use the ``locale(_:)`` modifier to create a copy of this format style with a different locale.

init · iOS 15.0+

init

TypeScript
static init(locale?: Locale): Decimal_FormatStyle_Percent
Swift declaration
init(locale: Locale = .autoupdatingCurrent)

Creates a decimal percent format style that uses the given locale. - Parameter locale: The locale to use when formatting or parsing decimal values. Defaults to `Locale.autoupdatingCurrent`.

method · iOS 15.0+

locale

TypeScript
locale73389(locale: Locale): Decimal_FormatStyle_Percent
Swift declaration
func locale(_ locale: Locale) -> Decimal.FormatStyle.Percent

Modifies the format style to use the specified locale. - Parameter locale: The locale to apply to the format style. - Returns: A decimal percent format style modified to use the provided locale.

method · iOS 15.0+

rounded

TypeScript
rounded(rule?: SDKHandle, increment?: (number) | null): Decimal_FormatStyle_Percent
Swift declaration
func rounded(rule: Decimal.FormatStyle.Percent.Configuration.RoundingRule = .toNearestOrEven, increment: Int? = nil) -> Decimal.FormatStyle.Percent

Modifies the format style to use the specified rounding rule and increment. - Parameters: - rule: The rounding rule to apply to the format style. - increment: A multiple by which the formatter rounds the fractional part. The formatter produces a value that is an even multiple of this increment. If this parameter is `nil` (the default), the formatter doesn't apply an increment. - Returns: A decimal percent format style modified to use the specified rounding rule and increment.

method · iOS 15.0+

grouping

TypeScript
grouping(group: NumberFormatStyleConfiguration_Grouping): Decimal_FormatStyle_Percent
Swift declaration
func grouping(_ group: Decimal.FormatStyle.Percent.Configuration.Grouping) -> Decimal.FormatStyle.Percent

Modifies the format style to use the specified grouping. - Parameter group: The grouping to apply to the format style. - Returns: A decimal percent format style modified to use the specified grouping.

method · iOS 15.0+

notation

TypeScript
notation(notation: NumberFormatStyleConfiguration_Notation): Decimal_FormatStyle_Percent
Swift declaration
func notation(_ notation: Decimal.FormatStyle.Percent.Configuration.Notation) -> Decimal.FormatStyle.Percent

Modifies the format style to use the specified notation. - Parameter notation: The notation to apply to the format style. - Returns: A decimal percent format style modified to use the specified notation.

method · iOS 16.0+

consuming

TypeScript
consuming(input: string, index: SDKHandle, bounds: SDKHandle): ({ "upperBound": SDKHandle; "output": Decimal }) | null
Swift declaration
func consuming(_ input: String, startingAt index: String.Index, in bounds: Range<String.Index>) throws -> (upperBound: String.Index, output: Decimal)?

Matches the input string within the specified bounds, beginning at the given index. Don't call this method directly. Regular expression matching and capture calls it automatically when matching substrings. - Parameters: - input: An input string to match against. - index: The index within `input` at which to begin searching. - bounds: The bounds within `input` in which to search. - Returns: The upper bound where the match terminates and a matched instance, or `nil` if there isn't a match.

method · iOS 15.0+

precision

TypeScript
precision(p: NumberFormatStyleConfiguration_Precision): Decimal_FormatStyle_Percent
Swift declaration
func precision(_ p: Decimal.FormatStyle.Percent.Configuration.Precision) -> Decimal.FormatStyle.Percent

Modifies the format style to use the specified precision. - Parameter p: The precision to apply to the format style. - Returns: A decimal percent format style modified to use the specified precision.

Skipped declarations

No declarations were skipped in this snapshot.

All Foundation types →