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
+25.6k Golang : Daemonizing a simple web server process example
+26.7k Golang : Find files by extension
+9.3k Golang : Web(Javascript) to server-side websocket example
+5.9k Golang : Compound interest over time example
+9.9k Golang : Translate language with language package example
+17.6k Golang : Defer function inside init()
+13.6k Golang : Activate web camera and broadcast out base64 encoded images
+15.8k Golang : Get current time from the Internet time server(ntp) example
+17.4k Golang : Linked list example
+12.1k Golang : Split strings into command line arguments
+14.3k Golang : On enumeration
+11k Golang : Read until certain character to break for loop