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