unit Unit14;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
bt1: TButton;
procedure bt1Click(Sender: TObject);
function HexToInt(Value: string): integer;
private
public
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.bt1Click(Sender: TObject);
var
iX : Integer;
cSource, cTarget, cT : string;
begin
cSource := '47 72 61 63 69 61 73 20 43 61 73 69 6D 69 72 6F 20 3A 29 0D 0A 0D 0A '+
'46 65 6C 69 63 69 64 61 64 65 73 20 44 61 6E 69 65 6C 20 70 6F 72 20 '+
'6C 6F 73 20 37 30 30 30 20 4D 65 6E 73 61 6A 65 73 2C 20 65 73 70 65 '+
'72 6F 20 71 75 65 20 73 65 20 63 75 6D 70 6C 61 6E 20 37 30 30 30 20 '+
'4D 61 73 20 3A 29 0D 0A 0D 0A 41 6C 20 66 69 6E 61 6C 20 73 69 20 65 '+
'72 61 20 75 6E 20 63 75 6D 70 6C 65 61 F1 6F 73 2C 20 62 75 65 6E 6F '+
'20 6D 61 73 20 6F 20 6D 65 6E 6F 73 20 3A 29';
cT := '';
for iX:=1 to Length(cSource) do
begin
if cSource[iX]<>' ' then
cT := cT + cSource[ix]
else
begin
cTarget := cTarget + Chr(HexToInt(cT));
cT := '';
end;
end;
ShowMessage(cTarget+Chr(HexToInt(cT)));
end;
function tform1.HexToInt(Value: string): integer;
const
cHex = '0123456789ABCDEF';
begin
Result := (16 * (Pos(Value[1], cHex) - 1)) + (Pos(Value[2], cHex) - 1);
end;
end.