let s = (0.45927).formatted(.percent.precision(.fractionLength(1...2)).attributed)
This result in an AttributedString of this:
-> 45 {
Foundation.NumberFormatPart = integer
}
-> . {
Foundation.NumberFormatSymbol = decimalSeparator
}
-> 93 {
Foundation.NumberFormatPart = fraction
}
-> % {
Foundation.NumberFormatSymbol = percent
}
How to get the four parts integer
, decimalSeparator
, fraction
, percent
parts each as String?
Nevermind, I found the answer: Attributed String Output | Gosh Darn Format Style!