Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function split(inputstr, sep)
- if(inputstr == nil or inputstr == "") then
- return nil
- end
- if sep == nil then
- sep = ","
- end
- local t={} ; i=1
- for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
- t[i] = str
- i = i + 1
- end
- return t
- end
- t = split("a,b,c,d,e,v",',')
- print(#t)
- for k,v in pairs(t) do
- print(k,":",v)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement