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