if Pos('.txt', str) > 0 then
begin
pos1:=Pos(' ',str);
str1:=copy(str,1,6);
str:=copy(str,7,length(str));
str2:=copy(str,1,6);
str:=copy(str,7,length(str));
str3:=copy(str,1,6);
end;
var str, s: string;
I: integer;
begin
str :='14.txt 12.txt 151.txt';
i := Pos('.txt', str);
while i > 0 do
begin
s := copy(str, 1, i +4);
delete(str, 1, i+4);
s := Trim(s);
showmessage(s);
i := Pos('.txt', str);
end;
end;