Difference between revisions of "Template:Hex2dec/sandbox"

From blackwiki
Jump to navigation Jump to search
imported>DePiep
(last pre-Lua code in sandbox to check effects)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<includeonly>{{#expr:{{hex2dec/2/sandbox|{{{1|0}}}|{{#expr:{{hex2dec/1/sandbox|{{{1|}}}}}-1}}}}+{{hex2dec/2/sandbox|{{{1|0}}}|{{#expr:{{hex2dec/1/sandbox|{{{1|}}}}}-2}}}}*16+{{hex2dec/2/sandbox|{{{1|0}}}|{{#expr:{{hex2dec/1/sandbox|{{{1|}}}}}-3}}}}*256+{{hex2dec/2/sandbox|{{{1|0}}}|{{#expr:{{hex2dec/1/sandbox|{{{1|}}}}}-4}}}}*4096+{{hex2dec/2/sandbox|{{{1|0}}}|{{#expr:{{hex2dec/1/sandbox|{{{1|}}}}}-5}}}}*65536+{{hex2dec/2/sandbox|{{{1|0}}}|{{#expr:{{hex2dec/1/sandbox|{{{1|}}}}}-6}}}}*1048576+{{hex2dec/2/sandbox|{{{1|0}}}|{{#expr:{{hex2dec/1/sandbox|{{{1|}}}}}-7}}}}*16777216+{{hex2dec/2/sandbox|{{{1|0}}}|{{#expr:{{hex2dec/1/sandbox|{{{1|}}}}}-8}}}}*268435456}}</includeonly><noinclude><!--
+
<includeonly>{{#ifeq:{{padleft:|2|{{{1|0}}}}}|0x
{{documentation}} -->
 
{{#ifeq:{{padleft:|2|fff}}|0x
 
 
   | {{Hex2dec/main  
 
   | {{Hex2dec/main  
     | {{lc:fff}}  
+
     | {{lc:{{{1|0}}}}}  
     | {{Hex2dec/1 | fff }}  
+
     | {{Hex2dec/1 | {{{1|0}}} }}  
 
     }}
 
     }}
 
   | {{Hex2dec/main  
 
   | {{Hex2dec/main  
     | 0x{{lc:fff}}  
+
     | 0x{{lc:{{{1|0}}}}}  
     | {{Hex2dec/1 | 0xfff }}  
+
     | {{Hex2dec/1 | 0x{{{1|0}}} }}  
 
     }}
 
     }}
}}
+
}}</includeonly><noinclude>
 +
{{documentation}}
 
</noinclude>
 
</noinclude>

Latest revision as of 14:30, 24 February 2013

Template documentation[view] [edit] [history] [purge]

Usage

  • {{hex2dec|0x0000}} → 0
  • {{hex2dec|0xA0}} → 160
  • {{hex2dec|0x7C0}} → 1984
  • {{hex2dec|0xFFFF}} → 65535
  • {{hex2dec|0x845FED}} → 8675309
  • {{hex2dec|0x75BCD15}} → 123456789
  • {{hex2dec|0xDEADBEEF}} → 3735928559
  • {{hex2dec|0xFFFFFFFF}} → 4294967295
Input formats

Input with or without 0x prefix:

  • {{hex2dec|0xa0}} → 160
  • {{hex2dec|a0}} → 160

Uppercase and lowercase accepted:

  • {{hex2dec|A0}} → 160
  • {{hex2dec|a0}} → 160
Not a number input
  • {{hex2dec|}} → 0
  • {{hex2dec}} → 0
  • {{hex2dec|0xAXYZ}} → 0
  • {{hex2dec|XYZ}} → 0
  • {{hex2dec|0xA B}} → 0
  • {{hex2dec|A B}} → 0

See also