Difference between revisions of "Template:Hex2dec/doc"

From blackwiki
Jump to navigation Jump to search
imported>Ark25
(Interwiki: +ro)
imported>Toohool
(update to reflect Lua implementation)
Line 1: Line 1:
 
{{Documentation subpage}}
 
{{Documentation subpage}}
{{esoteric}}
 
 
=== Usage ===
 
=== Usage ===
Works for all values in the range <tt>0x00</tt>–<tt>0xFFFFFFFF</tt>.
 
 
*<tt><nowiki>{{hex2dec|0x0000}}</nowiki> → {{hex2dec|0x0000}}</tt>
 
*<tt><nowiki>{{hex2dec|0x0000}}</nowiki> → {{hex2dec|0x0000}}</tt>
 
*<tt><nowiki>{{hex2dec|0xA0}}</nowiki> → {{hex2dec|0xA0}}</tt>
 
*<tt><nowiki>{{hex2dec|0xA0}}</nowiki> → {{hex2dec|0xA0}}</tt>
Line 17: Line 15:
 
*<tt><nowiki>{{hex2dec|0x00A0}}</nowiki> → {{hex2dec|0x00A0}}</tt>
 
*<tt><nowiki>{{hex2dec|0x00A0}}</nowiki> → {{hex2dec|0x00A0}}</tt>
 
*<tt><nowiki>{{hex2dec|A0}}</nowiki> → {{hex2dec|A0}}</tt>
 
*<tt><nowiki>{{hex2dec|A0}}</nowiki> → {{hex2dec|A0}}</tt>
 
===Technical details===
 
This template works in conjunction with the following subtemplates:
 
*{{tl|Hex2dec/main}}: does the actual multiplication and addition to create a decimal number.
 
*{{tl|Hex2dec/1}}: returns the length of the hexadecimal string.
 
*{{tl|Hex2dec/2}}: converts individual hexadecimal characters into their decimal equivalent.
 
  
 
=== See also ===
 
=== See also ===
Line 30: Line 22:
 
<includeonly>
 
<includeonly>
  
[[Category:Numerical conversion templates]]
+
[[Category:Numerical conversion templates|{{PAGENAME}}]]
 +
[[Category:Lua-based templates|{{PAGENAME}}]]
  
 
[[ro:Format:Hex2dec]]
 
[[ro:Format:Hex2dec]]
 
</includeonly>
 
</includeonly>

Revision as of 05:09, 24 February 2013

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

The template also accepts lowercase and padded hexadecimals with or without the prefix "0x":

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

See also