Module:Leading zeros

Revision as of 22:24, 24 January 2019 by imported>MusikAnimal (Protected "Module:Leading zeros": High-risk module ([Edit=Require autoconfirmed or confirmed access] (indefinite)))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This module is created for Template:SEHK. It is able to strip all leading zeros from the value (0001 to 1), while showing "Incorrect" as a error message when a non-numeric value is inputted. This module can be implemented to different template, if applicable.

UsageEdit

{{#invoke:Leading zeros |stripzeros |"number-goes-here"}}


p = {}
p.stripzeros = function(frame)
	x = tonumber(frame.args[1])
	if x then
		return x
	else
		return "Incorrect"
	end
end
return p