Jump to content

Module:StringUtil

From Shark's Hypothetical Weather

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

local p = {}

function p.stripEFPlus(frame)
	local input = frame.args[1] or ""
	return input:gsub("^EF", ""):gsub("P$", "")
end

-- Removes "EF" prefix only, e.g., EF3+ → 3+
function p.stripEFPrefix(frame)
	local input = frame.args[1] or ""
	return input:gsub("^EF", "")
end

function p.plusSuffix(frame)
	local input = frame.args[1] or ""
	if input:match("P$") then
		return "+"
	else
		return ""
	end
end

return p