Module:Sandbox/RexxS/Textsplit

Revision as of 21:31, 10 February 2021 by imported>RexxS (check for empty text)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:Sandbox/RexxS/Textsplit/doc

--[[ 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