Quick actions

cmd+k|ctrl+k

Navigation

Languages

split

Snippet info

Language

Lua

Visibility

public

Author

pheker

Created

2018-05-01T07:02:13Z

Updated

2018-05-01T07:02:13Z

print("Hello World!");

function split(inputstr, sep)
        if sep == nil then
                sep = "%s"
        end
        local t={} ; i=1
        for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
                t[i] = str
                i = i + 1
        end
        return t
end



list=split("1-2--3---4","-+");

for k,v in ipairs(list) do
    print(v);
end





INFO