您的位置:首页 > 编程语言 > Lua

lua字符串分割

2015-10-29 16:25 302 查看
function string_split(s,delim)
local start = 1;
local t = {};

while true do
local pos = string.find (s, delim, start, true)
if not pos then      break    end
table.insert (t, string.sub (s, start, pos - 1))
start = pos + string.len (delim)
end

table.insert (t, string.sub (s, start))
return t;
end
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: