各位大侠好!小弟想请教如何将edit1.text中的内容转换为十六进制,
例如:   edit1.text:='1234'
         请问如何将'1234'转换为十六进制马上给分

解决方案 »

  1.   

    function IntToHex(Value: Integer; Digits: Integer): string; overload;
    function IntToHex(Value: Int64; Digits: Integer): 
    string; overload;DescriptionIntToHex converts a number into a string containing the number's hexadecimal (base 16) representation. Value is the number to convert. Digits indicates the minimum number of hexadecimal digits to return.
    example:
    procedure TForm1.Button1Click(Sender: TObject);var
      i: Integer;
    begin
      Label1.Caption := '';
      for i := 1 to Length(Edit1.Text) do
      begin
        try
          Label1.Caption := Label1.Caption + IntToHex(Edit1.Text[i],2) + ' ';
        except
          Beep;
        end;
      end;
    end;
      

  2.   

    用这个函数即可:
                 inttohex(strtoint(edit1.text),4);
      

  3.   

    F1看帮助::IntToHex function
    UnitSysUtilsCategorynumeric formatting routinesfunction IntToHex(Value: Integer; Digits: Integer): string; overload;
    function IntToHex(Value: Int64; Digits: Integer): string; overload;DescriptionIntToHex converts a number into a string containing the number's hexadecimal (base 16) representation. Value is the number to convert. Digits indicates the minimum number of hexadecimal digits to return.