Template:Number: Difference between revisions
Created page with "<includeonly>{{#invoke:FormatNumber|main}}</includeonly><noinclude> <templatedata> { "params": { "1": { "label": "Number", "description": "The number to format (in lo..." |
Speedybrain (talk | contribs) No edit summary |
||
| (5 intermediate revisions by 2 users not shown) | |||
| Line 5: | Line 5: | ||
"1": { | "1": { | ||
"label": "Number", | "label": "Number", | ||
"description": "The number to | "description": "The number to display (in long form or scientific notation)", | ||
"example": "1e7", | "example": "10,000,000 or 1e7", | ||
" | "type": "number", | ||
" | "required": true | ||
}, | }, | ||
"format": { | "format": { | ||
"label": "Format", | "label": "Format", | ||
"description": "Force | "description": "Force one format for every reader: named or scientific. Leave it empty so readers see the format they chose under Appearance (preferred)", | ||
"example": "named", | "example": "named", | ||
"type": "string" | "type": "string" | ||
}, | |||
"prefix": { | |||
"label": "Prefix", | |||
"description": "Add an optional prefix to the number", | |||
"example": "$", | |||
"type": "string" | |||
}, | |||
"suffix": { | |||
"label": "Suffix", | |||
"description": "Add an optional suffix to the number", | |||
"example": "%", | |||
"type": "string" | |||
}, | |||
"sortkey": { | |||
"label": "Sort Key", | |||
"description": "Specify a custom sort key to override default table number sorting", | |||
"example": "Z", | |||
"type": "string" | |||
}, | |||
"icon": { | |||
"label": "Icon", | |||
"description": "Add an icon (e.g. for resource display)", | |||
"example": "{{Resource|White}}", | |||
"type": "string" | |||
}, | |||
"iconpos": { | |||
"label": "Icon Position", | |||
"description": "Position of the icon (if specified), 'left' places it on the left, otherwise defaults to the right", | |||
"example": "left", | |||
"type": "string", | |||
"default": "right" | |||
} | } | ||
}, | }, | ||
"description": " | "description": "Shows a large number as the game does, in the format each reader chose under Appearance: scientific notation (1.2E7, the default) or named numbers (12 M)", | ||
"format": "inline" | "format": "inline" | ||
} | } | ||
</templatedata> | </templatedata> | ||
Large numbers show in the format each reader picks under Appearance: scientific notation (1.2E7, the default) or named numbers (12 M). As in the game, the E is uppercase; the wiki sets it smaller than the digits. The other format is in the tooltip. Numbers below a million always show in full. | |||
== Examples == | |||
{| class="wikitable" | |||
!Input!!Output | |||
|- | |||
|<code><nowiki>{{Number|120000}}</nowiki></code>||{{Number|120000}} | |||
|- | |||
|<code><nowiki>{{Number|18000000000}}</nowiki></code>||{{Number|18000000000}} | |||
|- | |||
|<code><nowiki>{{Number|12456712473}}</nowiki></code>||{{Number|12456712473}} | |||
|- | |||
|<code><nowiki>{{Number|7.4e87}}</nowiki></code>||{{Number|7.4e87}} | |||
|- | |||
|<code><nowiki>{{Number|5E+34|format=named}}</nowiki></code>||{{Number|5E+34|format=named}} | |||
|- | |||
|<code><nowiki>{{Number|3.50e+09|format=scientific}}</nowiki></code>||{{Number|3.50e+09|format=scientific}} | |||
|- | |||
|<code><nowiki>{{Number|3555|prefix=$}}</nowiki></code>||{{Number|3555|prefix=$}} | |||
|- | |||
|<code><nowiki>{{Number|1.8e12|suffix=%}}</nowiki></code>||{{Number|1.8e12|suffix=%}} | |||
|- | |||
|<code><nowiki>{{Number|2e308}}</nowiki></code>||{{Number|2e308}} | |||
|- | |||
|<code><nowiki>{{Number|2e28|icon={{Resource|Blue}}}}</nowiki></code>||{{Number|2e28|icon={{Resource|Blue}}}} | |||
|} | |||
</noinclude> | </noinclude> | ||
Latest revision as of 23:01, 6 October 2026
Shows a large number as the game does, in the format each reader chose under Appearance: scientific notation (1.2E7, the default) or named numbers (12 M)
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| Number | 1 | The number to display (in long form or scientific notation)
| Number | required |
| Format | format | Force one format for every reader: named or scientific. Leave it empty so readers see the format they chose under Appearance (preferred)
| String | optional |
| Prefix | prefix | Add an optional prefix to the number
| String | optional |
| Suffix | suffix | Add an optional suffix to the number
| String | optional |
| Sort Key | sortkey | Specify a custom sort key to override default table number sorting
| String | optional |
| Icon | icon | Add an icon (e.g. for resource display)
| String | optional |
| Icon Position | iconpos | Position of the icon (if specified), 'left' places it on the left, otherwise defaults to the right
| String | optional |
Large numbers show in the format each reader picks under Appearance: scientific notation (1.2E7, the default) or named numbers (12 M). As in the game, the E is uppercase; the wiki sets it smaller than the digits. The other format is in the tooltip. Numbers below a million always show in full.