Return to Snippet

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


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

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


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

Initial URL

                                

Initial Description

                                

Initial Title
str_lpad - pad string to the left

Initial Tags

                                

Initial Language
Lua