Difference between revisions of "Template:Hex2dec"

From blackwiki
Jump to navigation Jump to search
imported>Ludwigs2
imported>Frietjes
(optional override for default to emit error)
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{#ifeq:{{padleft:|2|{{{1|0}}}}}|0x
+
{{#invoke: BaseConvert | convert
  | {{Hex2dec/main
+
  | n={{{1}}}  
    | {{lc:{{{1|0}}}}}  
+
  | base=10
    | {{Hex2dec/1 | {{{1|0}}} }}
+
  | from=16
    }}
+
  | default={{{default|0}}}
  | {{Hex2dec/main
+
}}<noinclude>{{documentation}}</noinclude>
    | 0x{{lc:{{{1|0}}}}}
 
    | {{Hex2dec/1 | 0x{{{1|0}}} }}
 
    }}
 
}}<noinclude>
 
{{documentation}}
 
</noinclude>
 

Latest revision as of 17:02, 11 June 2014

0

50px 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