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