TStringList.Delete

From Soldat Community Wiki
Jump to: navigation, search
procedure Delete(Index: Integer)
 Index: index of the string that is to be removed

Description

Delete deletes the string at position Index from the list.
The associated object is also removed from the list, but not destroyed.
Index is zero-based, and should be in the range 0 to Count-1.

Example

var
  s: TStringList;

begin
  s := File.CreateStringList();
  s.Append('a');
  s.Append('b');
  s.Append('c');
  
  s.Delete(1);
  
  WriteLn(s.CommaText);
  // a,c
  
  s.Free;
end.