View Single Post
 
Old 05-24-2017, 09:26 AM
RoyMoor RoyMoor is offline
Junior Member
 
Join Date: Oct 2014
Posts: 2
Default

var
I: Integer;
begin
for I:=0 to (MyStringList.Count div 2) - 1 do
begin
MyProcedure(MyStringList[I]);
MyProcedure(MyStringList[MyStringList.Count-1-I]);
end;
end;


But if yourlist has a possible odd count, it's safer to do the following (but you will end up with an empty stringlist).
So make and use a copy in front if you need the list afterwards:

begin
while MyStringList.Count > 0 do
begin
MyProcedure(MyStringList[0]);
MyStringList.Delete(0);
if MyStringList.Count > 0 then
begin
MyProcedure(MyStringList[MyStringList.Count-1]);
MyStringList.Delete(MyStringList.Count-1);
end;
end;
end;