|
sorry didn't see s.sort
But even so, it is not recommended to delete s in the count loop of i from s
In fact, it can also be written like this
procedure TForm1.Button1Click(Sender: TObject);
var
s,b: TStringList;
I: Integer;
begin
s := TStringList.Create;
b := TStringList.Create;
....
for i := s.Count-1 downto 1 do
if b.IndexOf(s[i])<0 then
b.Add(s[i]);
...
b.SaveToFile
b.free;
s.free;
end; |
|