Template:Version: Difference between revisions
Template page
More actions
Replaced content with " Category:Legend templates Category:Pages using the JsonConfig extension Category:Pages with TemplateStyles errors Category:Software templates Version Category:Templates using TemplateData Category:Templates using TemplateStyles" Tag: Replaced |
No edit summary |
||
Line 1: | Line 1: | ||
<onlyinclude><includeonly>{{#switch:{{{2}}} | |||
| 0 ={{#expr: {{{1}}} mod 10 }} | |||
| 1 ={{#expr: ({{{1}}}/ 10) mod 10 }} | |||
| 2 ={{#expr: ({{{1}}}/ 100) mod 10 }} | |||
| 3 ={{#expr: ({{{1}}}/ 1000) mod 10 }} | |||
| 4 ={{#expr: ({{{1}}}/ 10000) mod 10 }} | |||
| 5 ={{#expr: ({{{1}}}/ 100000) mod 10 }} | |||
| 6 ={{#expr: ({{{1}}}/ 1000000) mod 10 }} | |||
| 7 ={{#expr: ({{{1}}}/ 10000000) mod 10 }} | |||
| 8 ={{#expr: ({{{1}}}/ 100000000) mod 10 }} | |||
| 9 ={{#expr: ({{{1}}}/ 1000000000) mod 10 }} | |||
| 10 ={{#expr: ({{{1}}}/ 10000000000) mod 10 }} | |||
| 11 ={{#expr: ({{{1}}}/ 100000000000) mod 10 }} | |||
| 12 ={{#expr: ({{{1}}}/ 1000000000000) mod 10 }} | |||
| #default= 0 | |||
}}</includeonly></onlyinclude> | |||
{{documentation|content= | |||
This template extracts one digit from an integer value of up to 12 digits. | |||
== Usage == | |||
<code><nowiki>{{Cipher|{{{1}}}|{{{2}}}}}</nowiki></code> | |||
The first parameter is the integer value, the second is the position of the digit, from right to left (one, tenth, hundreds etc.). | |||
Having a value above the number of digits, a zero is returned. | |||
== Examples == | |||
<code><nowiki>{{Cipher|987654321</nowiki>'''<nowiki>0</nowiki>'''<nowiki>|0}}</nowiki></code> results in {{Cipher|9876543210|0}}. | |||
<code><nowiki>{{Cipher|</nowiki>'''<nowiki>9</nowiki>'''<nowiki>876543210|9}}</nowiki></code> results in {{Cipher|9876543210|9}}. | |||
<code><nowiki>{{Cipher|12345678</nowiki>'''<nowiki>9</nowiki>'''<nowiki>|0}}</nowiki></code> results in {{Cipher|123456789|0}}. | |||
<code><nowiki>{{Cipher|</nowiki>'''<nowiki>1</nowiki>'''<nowiki>23456789|8}}</nowiki></code> results in {{Cipher|123456789|8}}. | |||
<code><nowiki>{{Cipher|43</nowiki>'''<nowiki>2</nowiki>'''<nowiki>109876543210|12}}</nowiki></code> results in {{Cipher|432109876543210|12}}. | |||
<code><nowiki>{{Cipher|432109876543210|</nowiki>'''<nowiki>13</nowiki>'''<nowiki>}}</nowiki></code> results in {{Cipher|432109876543210|13}}! | |||
== Note == | |||
This template is used by templates with mathematical terms and therefore appears to be integrated in very few pages. | |||
[[Category:Number templates]] | |||
}} | |||
[[Category:Legend templates]] | [[Category:Legend templates]] |
Revision as of 17:19, 23 March 2025
This template extracts one digit from an integer value of up to 12 digits.
Usage
{{Cipher|{{{1}}}|{{{2}}}}}
The first parameter is the integer value, the second is the position of the digit, from right to left (one, tenth, hundreds etc.).
Having a value above the number of digits, a zero is returned.
Examples
{{Cipher|9876543210|0}}
results in 0.
{{Cipher|9876543210|9}}
results in 9.
{{Cipher|123456789|0}}
results in 9.
{{Cipher|123456789|8}}
results in 1.
{{Cipher|432109876543210|12}}
results in 2.
{{Cipher|432109876543210|13}}
results in 0!
Note
This template is used by templates with mathematical terms and therefore appears to be integrated in very few pages.