How To Show Only 2 Decimal Places In Swift

[Solved] How To Show Only 2 Decimal Places In Swift | Swift - Code Explorer | yomemimo.com
Question : how to show only 2 decimal places in swift

Answered by : bewildered-bison-13n5z68xwu0y

let myDouble = 3.141
let doubleStr = String(format: "%.2f", myDouble) // "3.14"

Source : https://stackoverflow.com/questions/34929932/round-up-double-to-2-decimal-places | Last Update : Thu, 04 Aug 22

Answers related to how to show only 2 decimal places in swift

Code Explorer Popular Question For Swift