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
+14k Golang : convert rune to unicode hexadecimal value and back to rune character
+7.1k Golang : Gargish-English language translator
+36k Golang : Integer is between a range
+9k Golang : Populate or initialize struct with values example
+6.8k Golang : Output or print out JSON stream/encoded data
+11.8k Golang : Verify Linux user password again before executing a program example
+5.4k Golang : Return multiple values from function
+25.3k Golang : Convert uint value to string type
+22k Fix "Failed to start php5-fpm.service: Unit php5-fpm.service is masked."
+16.5k Golang : Send email and SMTP configuration example
+28.8k Golang : Detect (OS) Operating System