Editing
Template:Cipher
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
<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]] }}
Summary:
By saving changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Cipher
(
edit
)
Template:Documentation
(
edit
)
Module:Arguments
(
view source
) (protected)
Module:Documentation
(
edit
)
Module:Documentation/config
(
edit
)
Module:Documentation/styles.css
(
edit
)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Template
Discussion
English
Views
Read
Edit source
View history
More
Search
Navigation
Main page
Community portal
Current events
Recent changes
Random page
Help
Donate
Tools
What links here
Related changes
Upload file
Special pages
Page information