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
+9.7k Javascript : Read/parse JSON data from HTTP response
+5.7k Unix/Linux : How to find out the hard disk size?
+7.5k Golang : Convert source code to assembly language
+31.4k Golang : Calculate percentage change of two values
+10k Golang : Translate language with language package example
+10.4k Golang : Use regular expression to get all upper case or lower case characters example
+12.1k Golang : Setup API server or gateway with Caddy and http.ListenAndServe() function example
+11.4k CodeIgniter : How to check if a session exist in PHP?
+8.6k Golang : Generate Datamatrix barcode
+5.4k Javascript : Change page title to get viewer attention
+48.1k Golang : Convert int to byte array([]byte)
+8.4k Golang : Qt splash screen with delay example