Link | lp_math_decToHex |
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 base16 string given a base10 integer.
Requires [lp_string_pad]
loop: -from=0, -to=30; loop_count ' ' (lp_math_dectohex: loop_count) '
'; /loop;
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_decToHex', -description='Returns a base16 string given a base10 integer.', -priority='replace', -required='base10', -copy; // http://www.danbbs.dk/~erikoest/hex.htm local:'base16'= string; // hex chars local:'hex_list'='0123456789ABCDEF'; #base10 = integer: #base10; while: #base10 > 0; #base16 = #hex_list->(get: (#base10 % 16) + 1) + #base16; #base10 = math_floor: (#base10 / 16); /while; // return base16 number return: (lp_string_pad: #base16, 2, '0'); /define_tag; ]
No comments
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft