string扩展模块新增trim方法

This commit is contained in:
MrZ626
2021-05-14 10:23:16 +08:00
parent 121e1421d3
commit 0ad122ce01

View File

@@ -16,6 +16,12 @@ do--function STRING.shiftChar(c)
end
end
function STRING.trim(str)
if not str:find("%S")then return""end
str=str:sub((str:find("%S"))):reverse()
return str:sub((str:find("%S"))):reverse()
end
function STRING.split(s,sep,regex)
local L={}
local p1,p2=1--start,target