ParseStrategy
- iOS
- 15.0+
- macOS
- 12.0+
- tvOS
- 15.0+
- watchOS
- 8.0+
struct ParseStrategy<Format> where Format : FormatStyle, Format.FormatInput == Decimal
struct ParseStrategy<Format> where Format : FormatStyle, Format.FormatInput == Decimal
s20FoundationEssentials7DecimalV0A20InternationalizationE13ParseStrategyV
What are these?3O3S3
import FoundationInternationalization
import FoundationEssentials
struct Decimal
protocol FormatStyle : Decodable, Encodable, Hashable
A type that can convert a given data type into a representation.
associatedtype FormatInput
The type of data to format.
init(_ value: String, format: Decimal.FormatStyle.Percent, lenient: Bool = true) throws
init(_ value: String, format: Decimal.FormatStyle.Currency, lenient: Bool = true) throws
init(_ value: String, format: Decimal.FormatStyle, 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 FormatStyle
protocol Decodable
A type that can decode itself from an external representation.
protocol Encodable
A type that can encode itself to an external representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable : Equatable
A type that can be hashed into a Hasher
to produce an integer hash value.
protocol ParseStrategy : Decodable, Encodable, Hashable
A type that can parse a representation of a given data type.
init(from decoder: any Decoder) throws
var formatStyle: Format
var lenient: Bool
static func fixed(format: Date.FormatString, timeZone: TimeZone, locale: Locale? = nil) -> Self where Self == Date.ParseStrategy
static func != (lhs: Self, rhs: Self) -> Bool
Returns a Boolean value indicating whether two values are not equal.
protocol Sendable
func parse(_ value: String) throws -> Format.FormatInput
init(format: Format, lenient: Bool = true)
struct Percent
init(format: Format, lenient: Bool = true)
struct Currency
init(format: Format, lenient: Bool = true)