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
+19.4k Golang : Set or Add HTTP Request Headers
+6.9k Golang : Squaring elements in array
+16.1k Golang : Test floating point numbers not-a-number and infinite example
+6.5k Golang : Derive cryptographic key from passwords with Argon2
+8.8k Golang : How to use Gorilla webtoolkit context package properly
+10.8k Golang : Read until certain character to break for loop
+12.1k Golang : Get month name from date example
+6.2k Golang : Handling image beyond OpenCV video capture boundary
+8.6k Golang : Accept any number of function arguments with three dots(...)
+18.2k Golang : Example for RSA package functions
+29.1k Golang : How to create new XML file ?