Create padString function

To avoid numerous substrings and wasted repeated lines