What is the function that removes trailing zeros from doubles?
var double = 3.0 var double2 = 3.10 println(func(double)) // 3 println(func(double2)) // 3.1
You can do it this way but it will return a string:
var double = 3.0 var double2 = 3.10 func forTrailingZero(temp: Double) -> String { var tempVar = String(format: "%g", temp) return tempVar } forTrailingZero(double) //3 forTrailingZero(double2) //3.1