BIN$ function

Purpose | Convert an integral value to a binary string.
Syntax | s$ = BIN$(IntVal [, Digits, LeadSpaces, TrailSpaces])

Remarks

IntVal is a numeric expression in the range of a 64-bit Quad Integer (-9223372036854775808 to +9223372036854775807). Any fractional part of the value is rounded. The result string is always formatted as an integral number using all the significant digits in IntVal. It is never expressed in scientific notation.

If Digits is 0 (or not given), no leading characters will be added to the numeric field. If Digits is a positive number greater than 0, the result string will be prepended with leading zeros to achieve the desired length. If Digits is a negative number, leading spaces are added to reach the absolute length. Digits may be in the range of -64 to +64.

LeadSpaces specifies additional leading spaces to be prepended, regardless of the length of the numeric portion of the string.

TrailSpaces specifies additional trailing spaces to be appended to the end of the string.

See also | DEC$, FORMAT$, HEX$, OCT$, STR$, TRIM$, USING$, VAL