Bin

From Xojo Documentation

Method

Bin(value as Integer) As String

Supported on Desktop,Web,Console.

Returns the binary version of the number passed as a string.

Syntax

result = Bin(value)

Part Type Description
result String Value converted to binary.
value Integer 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.

Examples

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"

See Also

&b, &h, &o literals; Hex, Oct, Integer.FromBinary, Integer.ToBinary functions