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
+16.1k Golang : Qt image viewer example
+14.1k Golang : How do I get the local IP (non-loopback) address ?
+10.1k Google Maps URL parameters configuration
+12.1k Golang : error parsing regexp: invalid or unsupported Perl syntax
+5.2k Golang : Debug with Godebug
+8.2k Golang : Read file with ioutil
+14.9k Golang : Find out mime type from bytes in buffer
+72.7k Golang : How to return HTTP status code?
+4k HTTP common errors and their meaning explained
+23.4k Golang : Create PDF file from HTML file
+7.2k Golang : How To Use Panic and Recover
+9.9k Golang : Delay or limit HTTP requests example