Module:Sandbox/RexxS/Textsplit

From English Wikipedia @ Freddythechick
--[[ Demonstrating the mw.text.split function --]]

local p = {}

function p.split(frame)
	local txt = frame.args.txt or ""
	local pids = {}
	if txt ~= "" then
		pids = mw.text.split(txt, "[, ]+")
	end
	local out = ">" .. table.concat(pids, "<<br>>") .. "<<br>Items: " .. #pids
	return out
end

return p