Difference between revisions of "Hex2Dec"
From Sonic Retro
BSonirachi (talk | contribs) m (Text replacement - "Category:Sonic Retro templates" to "Category:Templates") |
|||
(3 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
− | <includeonly><div style="display:none;">{{#vardefine:length|{{#len:{{{1|}}}}}}}{{#vardefine: | + | <includeonly><div style="display:none;">{{#vardefine:length|{{#len:{{{1|}}}}}}}{{#vardefine:hex2decresult|0}}{{#loop:n |
|0 | |0 | ||
|{{#var:length}} | |{{#var:length}} | ||
− | |{{#vardefine: | + | |{{#vardefine:hex2decresult|{{#expr:{{#var:hex2decresult}} + {{#switch:{{#sub:{{{1|}}}|{{#var:n}}|1}} |
|A|a=10 | |A|a=10 | ||
|B|b=11 | |B|b=11 | ||
Line 11: | Line 11: | ||
|#default={{#sub:{{{1|}}}|{{#var:n}}|1}} | |#default={{#sub:{{{1|}}}|{{#var:n}}|1}} | ||
}} * (16^({{#var:length}}-{{#var:n}}-1))}}}} | }} * (16^({{#var:length}}-{{#var:n}}-1))}}}} | ||
− | }}</div>{{#var: | + | }}</div>{{#var:hex2decresult}}{{clearvar|length|n}}</includeonly><noinclude> |
− | + | Hexadecimal to decimal convertor. | |
*0 -> {{Hex2Dec|0}} | *0 -> {{Hex2Dec|0}} | ||
Line 21: | Line 21: | ||
*BADbadBAD -> {{Hex2Dec|BADbadBAD}} | *BADbadBAD -> {{Hex2Dec|BADbadBAD}} | ||
− | [[Category: | + | [[Category:Templates]]</noinclude> |
Latest revision as of 19:17, 1 January 2022
Hexadecimal to decimal convertor.
- 0 -> 0
- 1 -> 1
- A -> 10
- 10 -> 16
- 1A -> 26
- BADbadBAD -> 50159344557