Only show decimal portion of Double with the decimal point
I'm trying to only show the decimal portion of a number but it keeps printing the number with the decimal point: for number 223.50: changeAmountLabel.text = "\(balance.truncatingRemainder(dividingBy: 1))" this will print .5, but what needs to be printed is 50, is there a way to do this? You can do this by using a NumberFormatter . Try this: let formatter = NumberFormatter() formatter.locale = Locale(identifier: "en_US_POSIX") formatter.minimumFractionDigits = 2 formatter.maximumFractionDigits = 3 let number = 223.50 if let str = formatter.string(from: NSNumber(value: number)) as? String { if