The other answers are good if you are dealing only with numbers using the format string, but this is good when you may have strings that need to be padded (although admittedly a little diffent than the question asked, seems similar in spirit). Also, be careful if the string is longer than the pad.
let str = "a str" let padAmount = max(10, str.count) String(repeatElement("-", count: padAmount - str.count)) + str Output "-----a str"