Home > AI > IOS > Foundation >

NumberFormatter

Example 1: turn number into spell format

let formatter = NumberFormatter()
formatter.numberStyle = .spellOut
formatter.locale = Locale(identifier: "es_ES") // to Spanish or to English
let english = formatter.string(from: 556)
print(english) // Optional("five hundred fifty-six")

Leave a Reply