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
+4.5k Golang : Display advertisement images or strings on random order
+14.5k Golang : Read large file with bufio.Scanner cause token too long error
+4.2k Python : Create Whois client or function example
+5.1k Golang : Missing Subversion command
+11.9k Golang : Handle or parse date string with Z suffix(RFC3339) example
+44.3k Golang : Marshal and unmarshal json.RawMessage struct example
+22.8k Golang : Daemonizing a simple web server process example
+6.1k Javascript : How to get JSON data from another website with JQuery or Ajax ?
+7.2k Your page has meta tags in the body instead of the head
+7.2k Golang : How To Use Panic and Recover
+12.7k Golang : Fix cannot use buffer (type bytes.Buffer) as type io.Writer(Write method has pointer receiver) error
+7k Golang : Append and add item in slice