Template:Signed number

From Terraria Wiki
Jump to navigation Jump to search
Important.svg
CAUTION: Terraria Wiki code is complex!!!
If you want to use this code on another wiki, wiki.gg staff are not able to assist you.
Please consider picking a different wiki to adapt code from, or making your own templates!
Remember that content on a wiki is more important than fancy formatting.
Template-info.svg Documentation The documentation below is transcluded from Template:Signed number/doc. (edit | history)
See also: Template:Sign

This simple helper template adds a sign (plus + or minus ) to a number input. It applies {{formatnum:}} to the input in the process (which, for instance, also adds thousands separators), provided the input is a valid number.

Usage

{{ signed number | <number> | zero = plus/minus/plusminus }}

First unnamed parameter

The input value. This should be a purely numerical value, otherwise the template may have unexpected results, since it treats the input as an expression.

zero

By default, no sign is displayed if the input is 0. This parameter can be used to display either a plus sign, a minus sign, or a plus–minus sign if the input is 0. It has no effect if the input is not 0.

Examples

Code Result
{{signed number|1}} +1
{{signed number|-1}} −1
{{signed number|0}} 0
{{signed number|0|zero=plus}} +0
{{signed number|0|zero=minus}} −0
{{signed number|0|zero=plusminus}} ±0
{{signed number|1|zero=minus}} +1
{{signed number|+1}} +1
{{signed number|one}} one
{{signed number|1000234}} +1,000,234