function HexByte(b: Byte): string;
const
  HexDigs: array [0..15] of char = '0123456789ABCDEF';
var
  bz: Byte;
begin
  bz:= b and $F;
  b:= b shr 4;
  Result:= HexDigs[b] + HexDigs[bz];
end;procedure TForm1.Button1Click(Sender: TObject);var
  i: Integer;
begin
  Label1.Caption := '';
  for i := 1 to Length(Edit1.Text) do
  begin
    try
      Label1.Caption := HexByte(StrToInt(Edit1.Text));
    except
      Beep;
    end;
  end;
end;

解决方案 »

  1.   

    这是一个把'0a'转化成10的例子,你看看
    var
        Text,buffer:PChar;
        S:  array [0..2] of char;
    begin
        Text:='0a';
        s:='11';
        Buffer:=@s[1];
        hextobin(Text,buffer,2);
        showmessage(inttostr(ord(buffer^)));
    end;
      

  2.   

    这是一个把'0a'转化成10的例子,你看看
    var
        Text,buffer:PChar;
        S:  array [0..2] of char;
    begin
        Text:='0a';
        s:='11';
        Buffer:=@s[1];
        hextobin(Text,buffer,2);
        showmessage(inttostr(ord(buffer^)));
    end;
      

  3.   

    这是一个把'0a'转化成10的例子,你看看
    var
        Text,buffer:PChar;
        S:  array [0..2] of char;
    begin
        Text:='0a';
        s:='11';
        Buffer:=@s[1];
        hextobin(Text,buffer,2);
        showmessage(inttostr(ord(buffer^)));
    end;