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;
用这个函数即可: inttohex(strtoint(edit1.text),4);
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.
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;
inttohex(strtoint(edit1.text),4);
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.