procedure GetDataFromText(str:String;var lens:integer;var results:string);
var i, p1, p2: Integer;
begin
Results := '';
lens:=0;
while str <> '' do
begin
i := 0;
p1 := Pos(' ',str);
p2 := Pos(#13#10,str);
if p1=1 then
begin Delete(str,1,1); continue; end;
if p2=1 then
begin Delete(str,1,2); continue; end;
if (p1=0) and (p2=0) and (str<>'') then
begin
i := StrToIntDef('$'+str,0);
//Delete(str,1,Length(str));
Delete(str,1,2);
end;
if ((p1>0) and (p2=0)) or
((p1>0) and (p2>0) and (p1<p2)) then
begin
i := StrToIntDef('$'+Copy(str,1,p1-1),0);
Delete(str,1,p1);
end;
if ((p1=0) and (p2>0)) or
((p1>0) and (p2>0) and (p1>p2)) then
begin
i := StrToIntDef('$'+Copy(str,1,p2-1),0);
Delete(str,1,p2+1);
end;
inc(lens);
Results := Results + Chr(i);
end; // while
end;
procedure TForm1.Button1Click(Sender: TObject);
var
str :string;
i :integer;
begin
str :='ff01aa';
i :=strtoint('$'+str) ;
showmessage(inttostr(i));
end;