str_lpad - pad string to the left


/ 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 right
  2. string.lpad = function(str, len, char)
  3. if char == nil then char = ' ' end
  4. return str .. string.rep(char, len - #str)
  5. end

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.