function HexBitToBin(ch: char): string;
begin
case ch of
'1': result := '0001';
'2': result := '0010';
'3': result := '0011';
'4': result := '0100';
'5': result := '0101';
'6': result := '0110';
'7': result := '0111';
'8': result := '1000';
'9': result := '1001';
'A': result := '1010';
'B': result := '1011';
'C': result := '1100';
'D': result := '1101';
'E': result := '1110';
'F': result := '1111';
else
result := '0000';
end;
end;
function IntToBin(n: integer): string;
var
i, index: integer;
hex: string;
begin
hex := IntToHex(n, 8);
result := '';
for i := 1 to 8do
result := result+HexBitToBin(hex);
if (result[1] = '0') then
begin
index := pos('1', result);
if index > 0 then
delete(result, 1, index-1)
else
result := '0';
end;
end;
虽然有HexToBin这个函数但我不会用,还要请大侠教我