string扩展模块新增trim方法
This commit is contained in:
@@ -16,6 +16,12 @@ do--function STRING.shiftChar(c)
|
|||||||
end
|
end
|
||||||
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)
|
function STRING.split(s,sep,regex)
|
||||||
local L={}
|
local L={}
|
||||||
local p1,p2=1--start,target
|
local p1,p2=1--start,target
|
||||||
|
|||||||
Reference in New Issue
Block a user