type
pPosition=^MyPosition;
MyPosition= array of Integer;
function GetPos(Dest,Source:string; Position:pPosition): Integer;
var
i,DelNum:Integer;
begin
i:=0;
DelNum:=0;
SetLength(Position^, 1);
while Pos(Dest, Source) > 0 do
begin
SetLength(Position^,i+1);
Position^[i] :=Pos(Dest,Source);
Source:=Copy(Source, Position^[i]+1,Length(Source)-Position^[i]);
Position^[i]:=Position^[i]+DelNum;
DelNum:=Position^[i];
i:=i+1;
end;
Result:=i-1;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
NewPosition: MyPosition;
i,j:Integer;
begin
i:=GetPos(Edit1.Text,Edit2.Text,@NewPosition);
for j:=0 to i do
begin
ShowMessage(IntToStr(NewPosition[j]));
end;
end;