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
+21.4k Golang : Create and resolve(read) symbolic links
+18.7k Golang : Send email with attachment
+13.3k Golang : How to calculate the distance between two coordinates using Haversine formula
+22.3k Golang : Print leading(padding) zero or spaces in fmt.Printf?
+12k Golang : GTK Input dialog box examples
+6.7k Golang : How to determine if request or crawl is from Google robots
+8.3k Golang : Metaprogramming example of wrapping a function
+33.1k Golang : How to check if a date is within certain range?
+17.9k Golang : Iterate linked list example
+10.2k Golang : Identifying Golang HTTP client request
+5.4k Swift : Convert string array to array example