Bin()

Syntax

Result$ = Bin(Value.q [, Type])
Description
Converts a quad numeric number into a string, in binary format.

Parameters

Value.q The number to convert.
Type (optional) If the value should be handled as another type, one of the following value can be specified:
  #PB_Quad   : The value is handled as a quad number, ranging from 0 to 18446744073709551615 (default)
  #PB_Byte   : The value is handled as a byte number, ranging from 0 to 255
  #PB_Ascii  : The value is handled as a ascii character, ranging from 0 to 255
  #PB_Word   : The value is handled as a word number, ranging from 0 to 65535
  #PB_Unicode: The value is handled as a unicode character, ranging from 0 to 65535
  #PB_Long   : The value is handled as a long number, ranging from 0 to 4294967296

Return value

A string holding the binary representation of the specified value.

Example

  Debug Bin(32) ; Will display "100000"
  Debug Bin(1024*1024*1024*1024) ; Will display "10000000000000000000000000000000000000000"

Remarks

If leading zero are needed in the output string, use the RSet() function as follows:
  Debug RSet(Bin(32), 16, "0") ; Will display "0000000000100000"

See Also

Str(), Val(), Hex()

Supported OS

All

<- Ascii() - String Index - Chr() ->