I have a double value as 22.368511 I want to round it to 2 decimal places. i.e. it should return 22.37
How can I do that?
In Swift 2.0 and Xcode 7.2:
let pi:Double = 3.14159265358979 String(format:"%.2f", pi)
Example: