str_rpad - pad string to the right


/ Published in: Lua
Save to your folder(s)



Copy this code and paste it in your HTML
  1. --- Pads str to length len with char from left
  2. string.rpad = function(str, len, char)
  3. if char == nil then char = ' ' end
  4. return string.rep(char, len - #str) .. str
  5. end

Report this snippet


Comments


You need to login to view comments.