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
+21.3k Golang : Setting up/configure AWS credentials with official aws-sdk-go
+12.6k Golang : Calculate elapsed years or months since a date
+8k PHP : How to parse ElasticSearch JSON ?
+30.4k error: trying to remove "yum", which is protected
+18.5k Golang : How to make function callback or pass value from function as parameter?
+7.1k Golang : Convert source code to assembly language
+10.9k Golang : Characters limiter example
+7.5k Golang : Handle Palindrome string with case sensitivity and unicode
+33.1k Golang : All update packages with go get command
+15.1k Golang : How to convert(cast) IP address to string?
+11.5k Golang : Detect user location with HTML5 geo-location
+16.2k Golang : Merge video(OpenCV) and audio(PortAudio) into a mp4 file