b9c7eb4d3e 2024-01-29 顽雨沉风: function string:lstrip()
b9c7eb4d3e 2024-01-29 顽雨沉风: return self:gsub("^%s+", "")
b9c7eb4d3e 2024-01-29 顽雨沉风: end
b9c7eb4d3e 2024-01-29 顽雨沉风: function string:rstrip()
b9c7eb4d3e 2024-01-29 顽雨沉风: return self:gsub("%s+$", "")
b9c7eb4d3e 2024-01-29 顽雨沉风: end
b9c7eb4d3e 2024-01-29 顽雨沉风: function string:strip()
b9c7eb4d3e 2024-01-29 顽雨沉风: local k1
b9c7eb4d3e 2024-01-29 顽雨沉风: k1 = self:lstrip()
b9c7eb4d3e 2024-01-29 顽雨沉风: return k1:rstrip()
b9c7eb4d3e 2024-01-29 顽雨沉风: end
b9c7eb4d3e 2024-01-29 顽雨沉风: function string:startswith(text)
b9c7eb4d3e 2024-01-29 顽雨沉风: if self:sub(1, #text) == text then
b9c7eb4d3e 2024-01-29 顽雨沉风: return self
b9c7eb4d3e 2024-01-29 顽雨沉风: end
b9c7eb4d3e 2024-01-29 顽雨沉风: end
b9c7eb4d3e 2024-01-29 顽雨沉风: function string:endswith(text)
b9c7eb4d3e 2024-01-29 顽雨沉风: if self:sub(-#text) == text then
b9c7eb4d3e 2024-01-29 顽雨沉风: return self
b9c7eb4d3e 2024-01-29 顽雨沉风: end
b9c7eb4d3e 2024-01-29 顽雨沉风: end