Link | lp_math_octetToDec |
Author | Bil Corry |
Category | Math |
Version | 8.x |
License | Public Domain |
Posted | 17 Jan 2006 |
Updated | 17 Jan 2006 |
More by this author... |
Returns a base10 integer given an array of integer octets.
Requires: [lp_math_dectobin] [lp_string_pad] [lp_integer_bytes] [lp_math_bintodec]
lp_math_octettodec: (array: 195, 164); // returns 50084
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_octetToDec', -description='Returns a base10 integer given an array of integer octets.', -priority='replace', -required='bytes', -copy; if: #bytes->type != 'array'; #bytes = (array: (integer: #bytes)); /if; local:'return' = string; local:'base2' = string; iterate: #bytes, local:'byte'; #base2 = (lp_math_dectobin: (integer:#byte)); if: #base2->size % 8 > 0; #base2 = (lp_string_pad: #base2, (#base2->size + (8 - (#base2->size % 8))) ,'0'); /if; loop: -from=0, -to=((lp_integer_bytes: (integer: #byte)) - 1); #return += #base2->(substring: (loop_count * 8) + 1, 8); /loop; /iterate; return: (lp_math_bintodec: #return); /define_tag; ]
No comments
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft