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
+15.3k Golang : Send email and SMTP configuration example
+81.8k Golang : How to convert character to ASCII and back
+9k Golang : Convert octal value to string to deal with leading zero problem
+7.8k Golang : Get final balance from bit coin address example
+20k Golang : Encrypt and decrypt data with TripleDES
+9.6k Golang : Get local time and equivalent time in different time zone
+12.1k CodeIgniter : "Fatal error: Cannot use object of type stdClass as array" message
+5.3k Golang : Build new URL for named or registered route with Gorilla webtoolkit example
+13.7k Golang : Search folders for file recursively with wildcard support
+22.7k Golang : Upload to S3 with official aws-sdk-go package
+19k Golang : How to get struct tag and use field name to retrieve data?
+5.8k Restart Apache or Nginx web server without password prompt