साँचा:Percent and number/doc
{{
साँचा:namespace detect
| type = notice
| image =
| imageright =
| class =
| style = margin-bottom:1.0em;
| textstyle =
| text = साँचा:strong for साँचा:terminate sentence
It contains usage information, categories and other content that is not part of the original साँचा page.
| small =
| smallimage =
| smallimageright =
| smalltext =
| subst =
| date =
| name =
}}
This template may be used to generate a percentage of total followed by the number. For the reverse, see साँचा:tl.
Usage
{{percent and number|number|total}}{{percent and number|number|total|decimals to round to (zero or greater)}}
Optional parameters
For two-column table output, use साँचा:para
To insert a line break before the parenthetical expression, use साँचा:para
To add a prefix to the numbers, use साँचा:para; for example, prefix=$
To add a suffix to the number, use साँचा:para; for example, suffix= units
To pad the result with zeros to achieve the desired precision, use साँचा:para.
To override the default right alignment in table mode, use साँचा:para or साँचा:para.
Basic examples
{{percent and number|3333|20000}} → साँचा:percent and number
{{percent and number|3333|20000|3}} → साँचा:percent and number
{{percent and number|3,333|20,000}} → साँचा:percent and number
{{percent and number|3,333|20,000|3}} → साँचा:percent and number
{{percent and number|111|1000|4|pad=yes}} → साँचा:percent and number
{{percent and number|3333|20000|disp=br()}} → साँचा:percent and number
Table display
{| class="wikitable sortable"
|-
! Location !! Percentage !! Population
|-
| City A || {{percent and number|5000|12000|disp=table}}
|-
| City B || {{percent and number|6500|12000|disp=table}}
|-
| City C || {{percent and number|500|12000|disp=table}}
|}
| Location | Percentage | Population |
|---|---|---|
| City A | साँचा:percent and number | |
| City B | साँचा:percent and number | |
| City C | साँचा:percent and number |
See also