08-25-2022, 08:19 AM
Code: (Select All)
bn$ = _BIN$(whateverNumber) 'the binary string returned by _BIN$
dw = 8 'desired field width
IF LEN(bn$) >= dw THEN
PRINT bn$ 'number already in desired width or even longer
ELSE
PRINT RIGHT$(STRING$(dw, "0") + bn$, dw) 'left padded with zeros
END IF
GuiTools, Blankers & other Projects:
https://staging.qb64phoenix.com/forumdisplay.php?fid=32
Libraries & useful Functions:
https://staging.qb64phoenix.com/forumdisplay.php?fid=23
https://staging.qb64phoenix.com/forumdisplay.php?fid=32
Libraries & useful Functions:
https://staging.qb64phoenix.com/forumdisplay.php?fid=23