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
+10.9k Golang : Read until certain character to break for loop
+5.5k Golang : Shortening import identifier
+16.6k Golang : Gzip file example
+15.6k Golang : How to login and logout with JWT example
+5.1k Responsive Google Adsense
+7.1k Ubuntu : connect() to unix:/var/run/php5-fpm.sock failed (13: Permission denied) while connecting to upstream
+7.2k Golang : How to detect if a sentence ends with a punctuation?
+33.5k Golang : How to check if slice or array is empty?
+9.5k Golang : Quadratic example
+9.1k Golang : Create and shuffle deck of cards example
+7.8k Javascript : Put image into Chrome browser's console
+5k Linux/Unix/MacOSX : Find out which application is listening to port 80 or use which IP version