Method
Bin
Description
Returns the binary version of the number passed as a string.
Usage
result = Bin(value)
Part |
Type |
Description |
---|---|---|
result |
Value converted to binary. |
|
value |
The number to be converted to binary. |
Notes
If the value is not a whole number, the decimal part will be truncated.
You can specify binary, hex, or octal numbers by preceding the number with the & symbol and the letter that indicates the number base. The letter b indicates binary, h indicates hex, and o indicates octal.
Sample code
Below are examples of various numbers converted to binary:
Var binVersion As String
binVersion = Bin(15) ' returns "1111"
binVersion = Bin(15.5) ' returns "1111"
binVersion = Bin(75) ' returns "1001011"
binVersion = Bin(&hF) ' returns "1111"
Compatibility
All project types on all supported operating systems.
See also
&b, &h, &o literals; Hex, Oct, Integer.FromBinary, Integer.ToBinary functions