I\'m trying to print a list of Strings all padded to the same width.
In C, I would use something like printf(\"%40s\", cstr), where cstr is a C string.<
Here's my solution, specific to String, but I'm sure someone smarter than I could make it more generic.
extension String {
func frontPadding(toLength length: Int, withPad pad: String, startingAt index: Int) -> String {
return String(String(self.reversed()).padding(toLength: length, withPad: pad, startingAt: index).reversed())
}
}