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
+6.1k Javascript : Get operating system and browser information
+7.2k Golang : Get Alexa ranking data example
+32.3k Golang : Convert []string to []byte examples
+23.7k Golang : minus time with Time.Add() or Time.AddDate() functions to calculate past date
+15.3k Golang : Save(pipe) HTTP response into a file
+23.6k Golang : Read a file into an array or slice example
+7k Mac OSX : Find large files by size
+8.4k Golang: Prevent over writing file with md5 hash
+15.9k Golang : ROT47 (Caesar cipher by 47 characters) example
+8.4k Golang : Auto-generate reply email with text/template package
+7.4k Golang : How to fix html/template : "somefile" is undefined error?
+12.4k Golang : Simple client-server HMAC authentication without SSL example