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
+20.2k Golang : Calculate time different
+4.1k Javascript : How to refresh page with JQuery ?
+4.3k Golang : Function as an argument type example
+12.3k Golang : Force download file example
+11.5k Golang : Tutorial on loading GOB and PEM files
+3.9k Golang : If else example and common mistake
+3.9k Golang : Grab news article text and use NLP to get each paragraph's sentences
+25.6k Golang : How to verify uploaded file is image or allowed file types
+8k Golang : Generate 403 Forbidden to protect a page or prevent indexing by search engine
+4.3k Golang : Find change in a combination of coins example
+35.5k Golang : UDP client server read write example
+8.2k Golang : Text file editor (accept input from screen and save to file)