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
In case you're looking how to remove trailing zeros from a string:
string.replacingOccurrences(of: "0*$", with: "", options: .regularExpression)
This will transform strings like "0.123000000" into "0.123"