Format Decimal Place Swift

[Solved] Format Decimal Place Swift | Swift - Code Explorer | yomemimo.com
Question : format decimal place swift

Answered by : jeremy-tandjung

let tip: Double = 15.2847320
let tipText: String = String(format: "%.2f", tip)
// %.2f for two decimal places

Source : https://www.hackingwithswift.com/example-code/strings/how-to-specify-floating-point-precision-in-a-string | Last Update : Sat, 21 Mar 20

Answers related to format decimal place swift

Code Explorer Popular Question For Swift