Bin

From Xojo Documentation
Jump to: navigation, search
Method

Bin(value as Integer) As String

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:

Dim 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 functions; Integer.FromBinary

Personal tools
Namespaces

Variants
Actions
Main
Content
Starting Out
Dig Deeper
More Help
Toolbox
About