Código Delphi [-] function IntToBin(Value, Digits: Cardinal): string; var Bit: Cardinal; begin Bit := 1; while Digits <> 0 do begin Result := Char(Byte((Value and Bit) <> 0) + Ord('0')) + Result; Bit := Bit shl 1; Dec(Digits); end; end;
function IntToBin(Value, Digits: Cardinal): string; var Bit: Cardinal; begin Bit := 1; while Digits <> 0 do begin Result := Char(Byte((Value and Bit) <> 0) + Ord('0')) + Result; Bit := Bit shl 1; Dec(Digits); end; end;
Código Delphi [-] Caption := IntToBin(Byte('@'), 8);
Caption := IntToBin(Byte('@'), 8);