Difference between revisions of "Template:Hex2dec/main"
Jump to navigation
Jump to search
imported>Ludwigs2 |
imported>Ludwigs2 (hack to cover most non-hex entries) |
||
| Line 1: | Line 1: | ||
| − | {{#expr: | + | {{#ifeq:{{{1}}}|{{uc:{{{1}}}}} |
| − | + | |{{#expr: | |
| − | + | {{Hex2dec/2 | {{{1|0}}} | {{#expr: {{{2|0}}}-1}}}} | |
| − | + | +{{Hex2dec/2 | {{{1|0}}} | {{#expr: {{{2|0}}}-2}}}}*16 | |
| − | + | +{{Hex2dec/2 | {{{1|0}}} | {{#expr: {{{2|0}}}-3}}}}*256 | |
| − | + | +{{Hex2dec/2 | {{{1|0}}} | {{#expr: {{{2|0}}}-4}}}}*4096 | |
| − | + | +{{Hex2dec/2 | {{{1|0}}} | {{#expr: {{{2|0}}}-5}}}}*65536 | |
| − | + | +{{Hex2dec/2 | {{{1|0}}} | {{#expr: {{{2|0}}}-6}}}}*1048576 | |
| − | + | +{{Hex2dec/2 | {{{1|0}}} | {{#expr: {{{2|0}}}-7}}}}*16777216 | |
| + | +{{Hex2dec/2 | {{{1|0}}} | {{#expr: {{{2|0}}}-8}}}}*268435456 | ||
| + | }} | ||
| + | |0 | ||
}}<noinclude>{{documentation}}</noinclude> | }}<noinclude>{{documentation}}</noinclude> | ||
Revision as of 16:30, 16 September 2010
0
This subtemplate of {{hex2dec}} is used to do the actual multiplication and addition needed to create a decimal number from a hexadecimal string. It is not meant to be called directly.
Usage
{{hex2dec/main | {{lc:0xFFAADDEE}} | {{Hex2dec/1 | 0xFFAADDEE }} }}
This template works in conjunction with the following templates:
- {{Hex2dec/1}}: returns the length of the hexadecimal string.
- {{Hex2dec/2}}: converts individual hexadecimal characters into their decimal equivalent.
| The above documentation is transcluded from Template:Hex2dec/main/doc. (edit | history) Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages. Please add categories to the /doc subpage. Subpages of this template. |