Or you could use robbieduncan's method...
Which I haven't tested
I just typed it into the reply box. If I was wanting to do this then that's how I'd implement it though. Should be about as efficient as it can be and is flexible enough.
I wasn't sure what the intended behaviour should be if the string is longer than length though so I left that unaltered. I'd imagine that it should trim the string to be a maximum of length characters long but maybe not?
Edit to add: there is a more efficient option if you are going to call this lots (thousands at least) of times. That would be to pre-generate some padding strings of various lengths (say 2,4,8,16) and use them to call append less. This would only be worth it if: 1) the character you pad with doesn't change much (or at all) 2) you are padding short strings into big lengths a lot (otherwise the lookup costs to get the best padding string would probably outweigh the additional times round the loop)