init(_:format:lenient:)
Creates and initializes a decimal by parsing a string according to the provided format style.
Declaration
init(_ value: String, format: Decimal.FormatStyle, lenient: Bool = true) throwsParameters
- value:
A string that contains a formatted decimal value.
- format:
A format style that describes formatting conventions used by the string. The initializer uses this format’s Parsestrategy to parse the string.
- lenient:
A Boolean value that indicates whether the parse strategy should permit some discrepancies when parsing. Defaults to
true.
Discussion
This initializer throws an error if the format style fails to parse the string into a decimal value.