Module:String
Jump to navigation
Jump to search
Documentation for this module may be created at Module:String/doc
-- Module:String
local p = {}
function p.split(frame, text, delimiter, index)
delimiter = delimiter or "%s" -- Default delimiter is whitespace
index = tonumber(index) or 1 -- Default index is 1
local i = 1
for part in string.gmatch(text, "([^" .. delimiter .. "]+)") do
if i == index then
return part
end
i = i + 1
end
return ""
end
return p