User:Diriector Doc/Sandbox/Number format
Appearance
This template uses Lua: |
Summary
[edit]Use this template to easily format a number. This template will replace misplaced separators and remove any unnecessary characters, including non-number characters and additional decimal points.
Usage
[edit]{{User:Diriector Doc/Sandbox/Number format|<number>|separator=<separator>|radix point=<radix point>}}
Examples
[edit]{{number format|123}} |
→ | ||
{{number format|1234}} |
→ | ||
{{number format|1234567890}} |
→ | ||
{{number format|-1234567890}} |
→ | - | |
{{number format|12345.67890}} |
→ | 12 345.67890 | |
{{number format|1234567890|separator=,}} |
→ | ||
{{number format|1234567890|separator=~~}} |
→ | ||
{{number format|1234567890|separator=}} |
→ | Removes separators | |
{{number format|12345.67890|radix point=,}} |
→ | 12 345,67890 | |
{{number format|12345.67890|radix point=~~}} |
→ | 12 345~~67890 | |
{{number format|12345.67890|radix point=}} |
→ | 12 34567890 | Removes radix point. Makes number hard to read, not recommended! |
{{number format|---1234567890}} |
→ | - | |
{{number format|123456-7890}} |
→ | ||
{{number format|123.4567.890}} |
→ | 123.4567890 | Ignores second decimal point |
{{number format|1 234,567'890}} |
→ | Convertes everything to a single format | |
{{number format|1 23 45678 90}} |
→ | Fixes improper formating | |
{{number format|12a4567b90}} |
→ | ||
{{number format|1**********0}} |
→ | ||
{{number format|<nowiki>12345</nowiki>}} |
→ | ??? | |
{{number format|1234567890123456789}} |
→ | No real limit to integer size | |
{{number format|1234567890 <ref>Some reference</ref>}} |
→ | ??? | |
{{number format|1234567890 [[Some link]]}} |
→ | ||
{{number format|Just text}} |
→ | ||
{{number format|}} |
→ | ||
{{number format}} |
→ | Template thinks {{{1}}} was input
|
See also
[edit]- {{formatnum:}} magic word
- {{formatnum:}} magic word on www.mediawiki.org
Template Data
[edit]This template will format an input number to fit any style and remove unnecessary characters with ease.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Number | 1 | The number to be formatted
| Number | required |
Separator | separator | The decimal separator for numbers 1000 and larger
| String | optional |
Radix Point | radix point | The symbol that separates the integer from the decimal value
| String | optional |
- ^ Some reference