Skip to content

Instantly share code, notes, and snippets.

@kobeumut
Created March 29, 2018 12:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kobeumut/48a791b90e68d637debceb41b8294645 to your computer and use it in GitHub Desktop.
Save kobeumut/48a791b90e68d637debceb41b8294645 to your computer and use it in GitHub Desktop.
String to NSDecimalNumber in Swift 3
let formatter = NumberFormatter()
formatter.generatesDecimalNumbers = true
formatter.numberStyle = NumberFormatter.Style.decimal
if let formattedNumber = formatter.number(from: textValue) as? NSDecimalNumber {
xa = formattedNumber
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment