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
+9.9k Golang : Convert(cast) float to int
+3.6k Golang : Calculate half life decay example
+36.4k Golang : How to count duplicate items in slice/array?
+5.9k Golang : How to execute code at certain day, hour and minute?
+4.3k CodeIgniter/PHP : Remove empty lines above RSS or ATOM xml tag
+11.5k Golang : Convert IP version 6 address to integer or decimal number
+8.4k Golang : Get UDP client IP address and differentiate clients by port number
+7.7k Facebook : Getting the friends list with PHP return JSON format
+13.7k Golang : Test floating point numbers not-a-number and infinite example
+7.4k Golang : Populate or initialize struct with values example
+6k Gogland : Single File versus Go Application Run Configurations
+11.1k Golang : Calculate elapsed years or months since a date