显示没有小数的双精度数?

Paa*_*une 3 double decimal swift

我想Double在 Swift 中显示一个没有小数的。

location.speed来自地图包。这是我尝试过的:

let kmt = location.speed * (18/5)
let theKmt = Double(round(10*kmt)/10)

statusLabel.text = "km/t\(theKmt)"
Run Code Online (Sandbox Code Playgroud)

use*_*248 5

你可能正在寻找这个:

let d: Double = 1.12345
statusLabel.text = String(format: "%.0f", d)
Run Code Online (Sandbox Code Playgroud)