Created
October 13, 2020 19:40
-
-
Save dfrobison/ed98e6a17219178d03bf4d783baf1d06 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Like we mentioned earlier, different locales separate decimals and thousands with a different symbol. Most English people will use commas for thousands, whereas in Spanish speaking countries we normally separate with periods. | |
//This can be done correctly with NumberFormatter. | |
let numFormatter = NumberFormatter() | |
numFormatter.numberStyle = .decimal | |
numFormatter.string(from: 32.823) // 32.823 (English), 32,823 (Spanish) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment