import Foundation
let readjustment = 1234.56789
let a = readjustment.formatted(.number.precision(.fractionLength(2)))
print(a) // 1,234.57
let locale = Locale(identifier: "ff_Adlm_GN")
let b = readjustment.formatted(.number.precision(.fractionLength(2)).locale(locale))
print(b) // 𞥑⹁𞥒𞥓𞥔.𞥕𞥗
let v = 1234.56789
v.formatted(.currency(code: "ESP").presentation(.narrow)) // ₧1,235
v.formatted(.currency(code: "USD").presentation(.narrow)) // $1,234.57
v.formatted(.currency(code: "KWD").presentation(.narrow)) // KWD 1,234.568
v.formatted(.currency(code: "UYW").presentation(.narrow)) // UYW 1,234.5679
网友评论