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
+8.3k Golang : How to generate Code 39 barcode?
+26.8k Golang : Connect to database (MySQL/MariaDB) server
+6.1k Golang : Check if one string(rune) is permutation of another string(rune)
+29.9k Golang : Example for ECDSA(Elliptic Curve Digital Signature Algorithm) package functions
+14.7k Golang : Generate universally unique identifier(UUID) example
+22.8k Golang : How to validate URL the right way
+6k Golang : How to detect if a sentence ends with a punctuation?
+22.8k Golang : How to print rune, unicode, utf-8 and non-ASCII CJK(Chinese/Japanese/Korean) characters?
+4.6k Python : Print unicode escape characters and string
+5.7k Unix/Linux : How to fix CentOS yum duplicate glibc or device-mapper-libs dependency error?
+7.3k Swift : Convert (cast) Character to Integer?
+35.6k Upload multiple files with Go