Module:Sandbox/RexxS/Textsplit

This is the current revision of this page, as edited by imported>RexxS at 22:31, 10 February 2021 (check for empty text). The present address (URL) is a permanent link to this version.

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
--[[ 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