init(_:format:lenient:)
- iOS
- 15.0+
- macOS
- 12.0+
- tvOS
- 15.0+
- watchOS
- 8.0+
init(_ value: String, format: Decimal.FormatStyle, lenient: Bool = true) throws
init(_ value: String, format: Decimal.FormatStyle, lenient: Bool = true) throws
s20FoundationEssentials7DecimalV0A20InternationalizationE_6format7lenientACSS_AcDE11FormatStyleVSbtKcfc
What are these?72TF5
import FoundationEssentials
import FoundationInternationalization
struct Decimal
@frozen struct String
A Unicode string value that is a collection of characters.
struct FormatStyle
@frozen struct Bool
A value type whose instances are either true
or false
.
init(_ value: String, format: Decimal.FormatStyle.Percent, lenient: Bool = true) throws
init(_ value: String, format: Decimal.FormatStyle.Currency, lenient: Bool = true) throws
init<S>(_ value: S.ParseInput, strategy: S) throws where S : ParseStrategy, S.ParseOutput == Decimal
Initialize an instance by parsing value
with the given strategy
.
func formatted() -> String
Format self
using Decimal.FormatStyle
func formatted<S>(_ format: S) -> S.FormatOutput where S : FormatStyle, S.FormatInput == Decimal
Format self
with the given format.
struct ParseStrategy<Format> where Format : FormatStyle, Format.FormatInput == Decimal