Percent
- iOS
- 15.0+
- macOS
- 12.0+
- tvOS
- 15.0+
- watchOS
- 8.0+
struct Percent
struct Percent
s30FoundationInternationalization24FloatingPointFormatStyleV7PercentV
What are these?42WBI
where Value:BinaryFloatingPoint
import FoundationInternationalization
struct FloatingPointFormatStyle<Value> where Value : BinaryFloatingPoint
protocol BinaryFloatingPoint : ExpressibleByFloatLiteral, FloatingPoint
A radix-2 (binary) floating-point type.
var parseStrategy: FloatingPointParseStrategy<FloatingPointFormatStyle<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
func locale(_ locale: Locale) -> FloatingPointFormatStyle<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: FloatingPointFormatStyle<Value>.Attributed { get }
var locale: Locale
var parseStrategy: FloatingPointParseStrategy<FloatingPointFormatStyle<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: FloatingPointFormatStyle<Value>.Percent.Configuration.DecimalSeparatorDisplayStrategy) -> FloatingPointFormatStyle<Value>.Percent
func format(_ value: Value) -> String
func grouping(_ group: FloatingPointFormatStyle<Value>.Percent.Configuration.Grouping) -> FloatingPointFormatStyle<Value>.Percent
func locale(_ locale: Locale) -> FloatingPointFormatStyle<Value>.Percent
func notation(_ notation: FloatingPointFormatStyle<Value>.Percent.Configuration.Notation) -> FloatingPointFormatStyle<Value>.Percent
func precision(_ p: FloatingPointFormatStyle<Value>.Percent.Configuration.Precision) -> FloatingPointFormatStyle<Value>.Percent
func rounded(rule: FloatingPointFormatStyle<Value>.Percent.Configuration.RoundingRule = .toNearestOrEven, increment: Double? = nil) -> FloatingPointFormatStyle<Value>.Percent
func scale(_ multiplicand: Double) -> FloatingPointFormatStyle<Value>.Percent
func sign(strategy: FloatingPointFormatStyle<Value>.Percent.Configuration.SignDisplayStrategy) -> FloatingPointFormatStyle<Value>.Percent
typealias Configuration = NumberFormatStyleConfiguration
typealias RegexOutput = Value
static var percent: FloatingPointFormatStyle<Double>.Percent { get }
static var percent: FloatingPointFormatStyle<Float>.Percent { get }
static var percent: FloatingPointFormatStyle<Float16>.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 localizedDoublePercentage(locale: Locale) -> Self
Creates a regex component to match a localized string representing a percentage and capture it as a Double
.
var regex: Regex<Self.RegexOutput> { get }
static func != (lhs: Self, rhs: Self) -> Bool
Returns a Boolean value indicating whether two values are not equal.