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
+23.9k Golang : Convert uint value to string type
+19.9k Golang : Get password from console input without echo or masked
+21.6k Golang : Get ASCII code from a key press(cross-platform) example
+7.8k Golang : Write multiple lines or divide string into multiple lines
+21.7k Golang : Gorilla mux routing example
+34.1k Golang : How to split or chunking a file to smaller pieces?
+14k Golang : rune literal not terminated error
+8.3k Golang : Find correlation coefficient example
+20.6k Golang : Setting up/configure AWS credentials with official aws-sdk-go
+12.3k Golang : Get dimension(width and height) of image file
+4.2k Python : Convert(cast) string to bytes example
+34.2k Golang : Validate IP address