str_length(string) will return the width of a string. Note that str_length() will also count whitespaces contained within a string.
str_pad() will append whitespace on the end of a string.
Arguments:
string = the variable or column containing the string you wish to pad.
width = a digit for the total length of the string once it has been padded with whitespaces. Note, specifying width = 30 on a string with 10 characters will result in a string of 30 characters. Specifying width = 30 on a string containing 20 characters will also return a padded string with 30 characters. The difference will be in the amount of whitespace added.
side: the side you want to pad the string on. You can specify, "right", "left", or "both".
str_trim() will delete whitespace surrounding a string. This is useful for eliminating inconsistencies introduced by human error.
Arguments:
string = the variable or column containing the string you wish to pad.
side: the side you want to pad the string on. You can specify, "right", "left", or "both".