Remove trailing zero's from Double swift iOS
Solution: If you had an output that contains 0.1 it will return 0.1.If it was 1.0 it will return 1.If it was 1.1 it return 1.1 func forTrailingZero(temp: Double) -> String { var roundDouble = String(format: "%g", temp) return roundDouble } Function Call: Var doub = 3.0 forTrailingZero(doub) //3