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: if self:sub(1, #text) == text then
60c256f91b 2024-06-27 14: return self
60c256f91b 2024-06-27 15: end
60c256f91b 2024-06-27 16: end
60c256f91b 2024-06-27 17: function string:endswith(text)
60c256f91b 2024-06-27 18: if self:sub(-#text) == text then
60c256f91b 2024-06-27 19: return self
60c256f91b 2024-06-27 20: end
60c256f91b 2024-06-27 21: end