摘要:
string.split=function(s,p)localrt={}string.gsub(s,'[^'..p..']+',function(w)table.insert(rt,w)end)returnrtend使用例子一localstr='abc,123,hello,ok'locallist=string.split(str,',')for_,sinipairs(list)doprint(s)end结果:abc123hellook使用例子二localstr='abc\n123\thellook'localli 阅读全文