Link | lp_math_hexToDec |
Author | Bil Corry |
Category | Math |
Version | 8.x |
License | Public Domain |
Posted | 05 Dec 2005 |
Updated | 05 Dec 2005 |
More by this author... |
Returns a base10 integer given a base16 string.
lp_math_hextodec:'2B2B'; // 11051 '
'; lp_math_hextodec:'0AFB2'; // 44978
Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.
[ define_tag:'lp_math_hexToDec', -description='Returns a base10 integer given a base16 string.', -priority='replace', -required='base16', -copy; // http://www.danbbs.dk/~erikoest/hex.htm #base16 = string: #base16; local:'base16_len' = #base16->length; local:'base10' = integer; local:'hex_list'='123456789ABCDEF'; iterate: #base16, local:'i'; #base10 += ((#hex_list->(find: (#base16->(get:loop_count)))) * (math_pow: 16, #base16_len - loop_count)); /iterate; // return base10 number return: (integer: #base10); /define_tag; ]
No comments
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft