- String转Int
let str: String = "10"
let a = Int(str)
- String转Double
let str: String = "10"
let a = Double(str)
- Int转String
let a: Int = 20
let str = String(a)
- Int转Double
let a: Int = 20
let b = Double(a)
- Double转String
let a: Double = 3.14
let str = String(stringInterpolationSegment: a)
- Double转Int
let a: Double = 3.14
let b = Int(a)