Documentation for this module may be created at Module:SplitCats/doc

local p = {}

function p.categories(frame)
	local raw = frame.args[1] or ''
	local prefix = frame.args[2] or 'Class '
	local out = {}
	for part in mw.text.gsplit(raw, ';', true) do
		part = mw.text.trim(part)
		if part ~= '' then
			table.insert(out, '[[Category:' .. prefix .. part .. ']]')
		end
	end
	return table.concat(out)
end

function p.letterCategory(frame)
	local title = mw.title.getCurrentTitle()
	local first = mw.ustring.upper(mw.ustring.sub(title.text, 1, 1))
	if mw.ustring.match(first, '[A-Z]') then
		return '[[Category:Soldiers ' .. first .. ']]'
	end
	return '[[Category:Soldiers other]]'
end

return p