模板:Isnumeric
外觀
此模板測試給定值是否為數字 (or at least, that it can be treated as such by the expression ParserFunction).
使用
By default, simply writing {{Isnumeric|1,327}}
(where 1,327 is an example number) will pass through the parameter if it's numeric and be blank if it's not. If the parameter boolean=true
is given, as in {{Isnumeric|1,327|boolean=true}}
, then the template will output 1
if numeric and 0
if not numeric.
示例
code | result |
---|---|
{{Isnumeric|1,327.50}} |
1,327.50 |
{{Isnumeric|9,999 (1950)}} | |
{{Isnumeric|9999999999999}} |
9999999999999 |
{{Isnumeric|500 metres}} | |
{{Isnumeric|500*500}} |
500*500 |
{{Isnumeric|9.999e50}} |
9.999e50 |
{{Isnumeric|1+1}} |
1+1 |
{{Isnumeric|}} |