Jump to content

Module:StringUtil

From Shark's Hypothetical Weather
Revision as of 11:19, 2 May 2025 by Sharkius (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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