|
BitTrim
The BitTrim function removes leading zero's
from the binary or hexadecimal string representation of a
number.
Syntax
|
sResult = BitTrim( sString )
|
sResult is the trimmed string
sString is the string to be trimmed.
Remarks
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.
Example
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.
|
n1 = 7 n2 = 18
|
|
|
s = BitDtoB( BitOr( n1, n2 )
)
|
|
|
Printf( "'%s --> %s'",
s, BitTrim( s) )
|
|
Related Topics
Boolean Math Functions
Mira Pro x64 Script User's Guide, v.8.76 Copyright Ⓒ 2024
Mirametrics, Inc. All Rights Reserved.
|