Skip to content

Instance MethodFoundationInternationalization

parse(_:)

iOS 15.0+ iPadOS 15.0+ Mac Catalyst 15.0+ macOS 12.0+ tvOS 15.0+ watchOS 8.0+
Parses a decimal string in accordance with this strategy and returns the parsed value.
func parse(_ value: String) throws -> Format.FormatInput

Parameters

value

The string to parse.

Return Value

The parsed decimal value.

Discussion

Use this method to repeatedly parse decimal strings with the same Decimal.ParseStrategy. To parse a single decimal string, use the initializers inherited from Decimal that take a String and a Decimal.FormatStyle as parameters.

This method throws an error if the parse strategy can’t parse the provided string.