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
+18.7k Golang : Iterating Elements Over A List
+10.6k Golang : Generate 403 Forbidden to protect a page or prevent indexing by search engine
+11.6k Golang : Surveillance with web camera and OpenCV
+12.1k Golang : Sort and reverse sort a slice of runes
+14k Golang : Compress and decompress file with compress/flate example
+32k Golang : Convert an image file to []byte
+7.7k Golang : Mapping Iban to Dunging alphabets
+7.3k Golang : Of hash table and hash map
+19.6k Golang : Close channel after ticker stopped example
+6k Golang : Compound interest over time example
+14.6k Golang : Convert(cast) int to float example