Skip to content

Instantly share code, notes, and snippets.

@dfrobison
Created October 13, 2020 19:40
Show Gist options
  • Save dfrobison/ed98e6a17219178d03bf4d783baf1d06 to your computer and use it in GitHub Desktop.
Save dfrobison/ed98e6a17219178d03bf4d783baf1d06 to your computer and use it in GitHub Desktop.
//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