ACSII与十六进制转换
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
str1:string;
str2:string;
cov:array of byte;
a,len,i:byte;
begin
str1:=edit1.Text ;
str2:='';
len:=strlen(pchar(str1));
setlength(cov,len);
for i:=1 to len do
begin
cov:=ord(str1);
end;
for i:=1 to len do
begin
str2:=str2+ inttohex(cov,2)+' ';
end;
edit2.Text :=str2;
end;
end.