Template:Numtext

From Wikipedia, the free encyclopedia

This template employs intricate features of template syntax.
You are encouraged to familiarise yourself with its setup and parser functions before editing the template. If your edit causes unexpected problems, please undo it quickly, as this template may appear on a large number of pages.
Remember that you can conduct experiments, and should test all improvements, in either the general Template sandbox or your user space before changing anything here.
[edit] Template documentation

Contents

[edit] Usage

{{Numtext|x}} takes in an integer, x, in numeral form and returns that integer in written form.

{{Numtext}} currently works for integers between 0 and 900,000,000,000,000,000 (900 quadrillion). As per the Wikipedia Manual of Style, numtext will at most return two words for any given integer. To do this the template will round down to the nearest two-word integer. For numbers with 6, 9, or 12 digits the template gives a number and a word. Numbers larger than a quintillion are rounded down to that number.

The switch |caps=on will capitalize the first letter of the output.

[edit] Advantages

  • {{Numtext}} can be used to output a number returned by another function template (or magic word) in written form.
  • {{Numtext}} can be used to round such numbers down to a "nice round number".
  • Time-based text can be written in such a way that it will not have to be updated.

For example, one could write either:

Wikipedia has {{NUMBEROFUSERS}} users.
Wikipedia has 7,287,352 users.

or

Wikipedia has over {{numtext|{{NUMBEROFUSERS:R}}}} users.
Wikipedia has over seven million users.

[edit] Examples

Code Produces
{{numtext|0}} zero
{{numtext|1|caps=on}} One
{{numtext|2}} two
{{numtext|2.7}} two
{{numtext|10|caps=on}} Ten
{{numtext|11}} eleven
{{numtext|35|caps=on}} Thirty-five
{{numtext|96}} ninety-six
{{numtext|99.6}} ninety-nine
{{numtext|2800|caps=on}} Two thousand
{{numtext|28000}} twenty thousand
{{numtext|280000}} 200 thousand
{{numtext|2800000|hyph=on}} two-million
{{numtext|28000000}} twenty million
{{numtext|280000000}} 200 million
{{numtext|2800000000|lk=on}} two billion
{{numtext|28000000000}} twenty billion
{{numtext|280000000000}} 200 billion
{{numtext|2800000000000}} two trillion
{{numtext|28000000000000|lk=on}} twenty trillion
{{numtext|280000000000000}} 200 trillion
{{numtext|2800000000000000}} two quadrillion
{{numtext|28000000000000000|lk=on}} twenty quadrillion
{{numtext|280000000000000000|lk=on}} 200 quadrillion
{{numtext|2800000000000000000|lk=on}} quintillion

[edit] Auxiliary templates

A list of subtemplates can be found at Category:Subtemplates of Template Numtext.


[edit] See also