specifier / formatter
import SwiftUI
let pi = Double.pi
let str: LocalizedStringKey = "\(pi, specifier: "%.2f")"
When there is a type (not String) which conforms to ExpressibleByStringInterpolation and its associated StringInterpolation has a method .appendInterpolation(_:specifier:), you can use String Interpolation literals like:
"\(pi, specifier: "%.2f")"
String Programming Guide (๐ด) โฉ
Core Foundation โฉ String Format Specifiers
Swift โฉ CVarArg (protocol) - ๅฏไปฅ่ขซไธ้ฒ String(format:) ็ถ (variadic) arguments ็ใ
applied for String.
similar to String Interpolation.
used by .decimalPlaces()method.
Last updated