Swift : Convert (cast) String to Double
Helping out a colleague to solve this simple task of converting string value to double today. Putting down this solution here and hope it can be useful as tutorial for other Swift programmers.
Problem :
How to convert (cast) String to Double in Swift programming language ?
Solution :
var str = "123.456"
var doubleNSString = NSString(string: str)
var toDouble = doubleNSString.doubleValue
Reference :
See also : Swift : Convert (cast) Int to String ?
By Adam Ng
IF you gain some knowledge or the information here solved your programming problem. Please consider donating to the less fortunate or some charities that you like. Apart from donation, planting trees, volunteering or reducing your carbon footprint will be great too.
Advertisement
Tutorials
+29.3k Golang : Generate random string
+6.9k Golang : Test if an input is an Armstrong number example
+5.9k Golang : Warp text string by number of characters or runes example
+10.7k CodeIgniter : Import Linkedin data
+8.2k Golang : Go as a script or running go with shebang/hashbang style
+5.2k Golang : Compound interest over time example
+15.3k Golang :Trim white spaces from a string
+26.9k Golang : Decode/unmarshal unknown JSON data type with map[string]interface
+18.3k Golang : Fix cannot download, $GOPATH not set error
+23.1k Golang : Call function from another package
+9.2k Golang : Print how to use flag for your application example