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.6k Golang : How to get time from unix nano example
+17.3k Golang : [json: cannot unmarshal object into Go value of type]
+21k Curl usage examples with Golang
+35.5k Golang : Get file last modified date and time
+4.8k Linux : How to set root password in Linux Mint
+7.7k Golang Hello World Example
+10.7k Golang : Fix go.exe is not compatible with the version of Windows you're running
+8.5k Yum Error: no such table: packages
+18.5k Golang : Padding data for encryption and un-padding data for decryption
+4.9k Golang : Print instead of building pyramids
+20.7k Golang : How to force compile or remove object files first before rebuild?
+5.4k Golang : Configure crontab to poll every two minutes 8am to 6pm Monday to Friday