IntegerFormatStyle
- iOS
- 15.0+
- macOS
- 12.0+
- tvOS
- 15.0+
- watchOS
- 8.0+
struct IntegerFormatStyle<Value> where Value : BinaryInteger
struct IntegerFormatStyle<Value> where Value : BinaryInteger
import FoundationInternationalization
protocol BinaryInteger : CustomStringConvertible, Hashable, Numeric, Strideable where Self.Magnitude : BinaryInteger, Self.Magnitude == Self.Magnitude.Magnitude
An integer type with a binary representation.
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 Sendable
init(from decoder: any Decoder) throws
init(locale: Locale = .autoupdatingCurrent)
var attributed: IntegerFormatStyle<Value>.Attributed { get }
var locale: Locale
func decimalSeparator(strategy: IntegerFormatStyle<Value>.Configuration.DecimalSeparatorDisplayStrategy) -> IntegerFormatStyle<Value>
func grouping(_ group: IntegerFormatStyle<Value>.Configuration.Grouping) -> IntegerFormatStyle<Value>
func notation(_ notation: IntegerFormatStyle<Value>.Configuration.Notation) -> IntegerFormatStyle<Value>
func precision(_ p: IntegerFormatStyle<Value>.Configuration.Precision) -> IntegerFormatStyle<Value>
func rounded(rule: IntegerFormatStyle<Value>.Configuration.RoundingRule = .toNearestOrEven, increment: Int? = nil) -> IntegerFormatStyle<Value>
func scale(_ multiplicand: Double) -> IntegerFormatStyle<Value>
func sign(strategy: IntegerFormatStyle<Value>.Configuration.SignDisplayStrategy) -> IntegerFormatStyle<Value>
typealias Configuration = NumberFormatStyleConfiguration
static func != (lhs: Self, rhs: Self) -> Bool
Returns a Boolean value indicating whether two values are not equal.
protocol Copyable
A type whose values can be implicitly or explicitly copied.
protocol CustomConsumingRegexComponent : RegexComponent
protocol Escapable
protocol FormatStyle : Decodable, Encodable, Hashable
A type that can convert a given data type into a representation.
protocol ParseableFormatStyle : FormatStyle
A type that can convert a given data type into a representation.
protocol RegexComponent<RegexOutput>
A type that represents a regular expression.
var parseStrategy: IntegerParseStrategy<IntegerFormatStyle<Value>> { get }
func consuming(_ input: String, startingAt index: String.Index, in bounds: Range<String.Index>) throws -> (upperBound: String.Index, output: Value)?
func format(_ value: Value) -> String
Returns a localized string for the given value. Supports up to 64-bit signed integer precision. Values not representable by Int64
are clamped.
func locale(_ locale: Locale) -> IntegerFormatStyle<Value>
struct Attributed
struct Currency
struct Percent
typealias RegexOutput = Value
static var number: IntegerFormatStyle<Int> { get }
static var number: IntegerFormatStyle<UInt> { get }
static var number: IntegerFormatStyle<Int8> { get }
static var number: IntegerFormatStyle<Int16> { get }
static var number: IntegerFormatStyle<Int32> { get }
static var number: IntegerFormatStyle<Int64> { get }
static var number: IntegerFormatStyle<UInt8> { get }
static var number: IntegerFormatStyle<UInt16> { get }
static var number: IntegerFormatStyle<UInt32> { get }
static var number: IntegerFormatStyle<UInt64> { get }
static func currency<Value>(code: String) -> Self where Self == FloatingPointFormatStyle<Value>.Currency, Value : BinaryFloatingPoint
static func currency<V>(code: String) -> Self where Self == IntegerFormatStyle<V>.Currency, V : BinaryInteger
static func list<MemberStyle, Base>(memberStyle: MemberStyle, type: ListFormatStyle<MemberStyle, Base>.ListType, width: ListFormatStyle<MemberStyle, Base>.Width = .standard) -> Self where Self == ListFormatStyle<MemberStyle, Base>, MemberStyle : FormatStyle, Base : Sequence, MemberStyle.FormatInput == Base.Element, MemberStyle.FormatOutput == String
static func list<Base>(type: ListFormatStyle<StringStyle, Base>.ListType, width: ListFormatStyle<StringStyle, Base>.Width = .standard) -> Self where Self == ListFormatStyle<StringStyle, Base>, Base : Sequence, Base.Element == String
static func localizedInteger(locale: Locale) -> Self
Creates a regex component to match a localized integer string and capture it as a Int
.
var regex: Regex<Self.RegexOutput> { get }