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
+17.6k Golang : Check if IP address is version 4 or 6
+10.3k Golang : Compare files modify date example
+10.5k Golang : Convert file unix timestamp to UTC time example
+9.8k Golang : How to extract video or image files from html source code
+23.8k Golang : Read a file into an array or slice example
+11.4k Golang : How to determine a prime number?
+12.6k Golang : Extract part of string with regular expression
+5.9k Linux/Unix/PHP : Restart PHP-FPM
+34k Golang : convert(cast) bytes to string
+16.1k Golang : Update database with GORM example
+10.1k Golang : Convert octal value to string to deal with leading zero problem
+30.1k Golang : Record voice(audio) from microphone to .WAV file