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)
你可能正在寻找这个:
let d: Double = 1.12345
statusLabel.text = String(format: "%.0f", d)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4457 次 |
| 最近记录: |