|
function string:split (sep)
|
|
local sep, fields = sep or ":", {}
|
|
local pattern = string.format("([^%s]+)", sep)
|
|
self:gsub(pattern, function(c) fields[#fields+1] = c end)
|
|
return fields
|
|
end
|
|
|
|
local str = "Hello,How,Are,You,Today"
|
|
print(table.concat(str:split(","), "."))
|