Return to Snippet

Revision: 12424
at March 14, 2009 08:38 by ukpyr


Updated Code
--- Pads str to length len with char from left
string.rpad = function(str, len, char)
    if char == nil then char = ' ' end
    return string.rep(char, len - #str) .. str
end

Revision: 12423
at March 13, 2009 12:12 by ukpyr


Initial Code
--- Pads str to length len with char from left
function str_rpad(str, len, char)
    if char == nil then char = ' ' end
    while #str < len do str = char .. str end
    return str
end

Initial URL

                                

Initial Description

                                

Initial Title
str_rpad - pad string to the right

Initial Tags

                                

Initial Language
Lua