Skip to content

Instantly share code, notes, and snippets.

@oscarmorrison
Created June 28, 2015 12:29
Show Gist options
  • Save oscarmorrison/4c9b156ec3f1c4d9d0c2 to your computer and use it in GitHub Desktop.
Save oscarmorrison/4c9b156ec3f1c4d9d0c2 to your computer and use it in GitHub Desktop.
String to Int/Double/Float
var intString = "10"
var numberInt = intString.toInt()
var numberString = "10.1"
var numberDouble = (numberString as NSString).doubleValue
var numberFloat = NSString(string: numberString).floatValue
@serejahh
Copy link

What about numbers separated by a comma?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment