Created
June 28, 2015 12:29
-
-
Save oscarmorrison/4c9b156ec3f1c4d9d0c2 to your computer and use it in GitHub Desktop.
String to Int/Double/Float
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
var intString = "10" | |
var numberInt = intString.toInt() | |
var numberString = "10.1" | |
var numberDouble = (numberString as NSString).doubleValue | |
var numberFloat = NSString(string: numberString).floatValue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What about numbers separated by a comma?