Module:Utilities: Difference between revisions

added string_endswith function
Sur (talk | contribs)
m add_space_before_cap
Line 39: Line 39:
    return ending == "" or str:sub(-#ending) == ending
    return ending == "" or str:sub(-#ending) == ending
end
end
-- Add a space before each capital letter that is not the first character
-- i.e. BulletVelocity > Bullet Velocity
function p.add_space_before_cap(str)
    return str:gsub("(%u)", function(c)
        return " " .. c
    end, 2)
end
return p
return p