Lua 字符串处理

local zstr = {}

-- from http://zhaiku.blog.51cto.com/2489043/1163077
function zstr.split(str, delim)
    local rt = {}
    if (delim == nil) then delim = ',' end
    if (str ~= nil) then
        string.gsub(str, '[^'..delim..']+', function(w) table.insert(rt, w) end)
        return rt
    end
    return nil
end

return zstr;

results matching ""

    No results matching ""