60c256f91b 2024-06-27 1: function string:lstrip()
60c256f91b 2024-06-27 2: return self:gsub("^%s+", "")
60c256f91b 2024-06-27 3: end
60c256f91b 2024-06-27 4: function string:rstrip()
60c256f91b 2024-06-27 5: return self:gsub("%s+$", "")
60c256f91b 2024-06-27 6: end
60c256f91b 2024-06-27 7: function string:strip()
60c256f91b 2024-06-27 8: local h1
60c256f91b 2024-06-27 9: h1 = self:lstrip()
60c256f91b 2024-06-27 10: return h1:rstrip()
60c256f91b 2024-06-27 11: end
60c256f91b 2024-06-27 12: function string:startswith(text)
60c256f91b 2024-06-27 13: local size = text:len()
60c256f91b 2024-06-27 14: if self:sub(1, size) == text then
60c256f91b 2024-06-27 15: return self
60c256f91b 2024-06-27 16: end
60c256f91b 2024-06-27 17: end
60c256f91b 2024-06-27 18: function string:endswith(text)
60c256f91b 2024-06-27 19: if self:sub(-#text) == text then
60c256f91b 2024-06-27 20: return self
60c256f91b 2024-06-27 21: end
60c256f91b 2024-06-27 22: end