no

Common Swift collection casting or type conversion

Collection of Common Swift Casting  or Type Conversion String to Double var a  = "1.5" var b  =  (a as NSString).doubleValue ...

Collection of Common Swift Casting  or Type Conversion

String to Double
var a  = "1.5"
var b  = (a as NSString).doubleValue

Double to String
var a : Double = 1.5
var b  = String(format:"%f", a)

Double to Int
var a : Double = 1.5
var b  = Double(a)

String to Float
var a  = "1.5"
var b  = (a as NSString).floatValue

String to Float
var a  = "1.5"
var b  = (a as NSString).intValue


Related

iOS 7047522272838137813

Post a Comment

item