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.5k Golang : Generate QR codes for Google Authenticator App and fix "Cannot interpret QR code" error
+6.5k Golang : How to determine if request or crawl is from Google robots
+10k Golang : Identifying Golang HTTP client request
+22.9k Golang : Calculate time different
+24.9k Golang : Create PDF file from HTML file
+34.6k Golang : How to stream file to client(browser) or write to http.ResponseWriter?
+6.6k Golang : Check if password length meet the requirement
+6.9k Web : How to see your website from different countries?
+12.5k Golang : flag provided but not defined error
+26k Mac/Linux and Golang : Fix bind: address already in use error
+14.5k Golang : How to check if your program is running in a terminal
+6.5k Golang : Map within a map example