Using Swift 5’s fancy new extendible interpolation:
extension DefaultStringInterpolation { mutating func appendInterpolation(pad value: Int, toWidth width: Int, using paddingCharacter: Character = "0") { appendInterpolation(String(format: "%\(paddingCharacter)\(width)d", value)) } } print("I ate \(pad: pieCount, toWidth: 3, using: "0") pies") // => `I ate 003 pies`