BitTrim
The BitTrim function removes leading zero's from the binary or hexadecimal string representation of a number.
sResult = BitTrim( sString ) |
sResult is the trimmed string
sString is the string to be trimmed.
Hexadecimal and binary representations of numbers can have a long string of leading 0's. This function trims all leadingh 0's to make the number more manageable. For example, the decimal number 33 has only the bits at position 6 and 1 set, so its binary representation is 00000000000000000000000000100001. Using BitTrim(), the binary representation becomes 100001.
The following script trims the leading zero's from the binary result of a BitOr operation on 2 small numbers. The script uses the BitDtoB function to convert the decimal result of the OR operation to a binary string representation.
|
-- pick 2 numbers |
|
-- compute the OR and convert to a binary string |
|
-- prints 00000000000000000000000000010111 --> 10111 |
Mira Pro x64 Script User's Guide, Copyright Ⓒ 2024 Mirametrics,
Inc. All Rights Reserved.