procedure TForm1.Button1Click(Sender: TObject);var L : TStringList;begin L := TStringList.Create; L.Duplicates:=dupIgnore; L.Text:=Memo1.Text Memo1.Text:=L.Text; L.Free;end;
Extremely stupid, huh?
Quote from: anna on August 05, 2010, 05:01:40 pmExtremely stupid, huh?Yes ;-)This only works if the StringList ist sorted. This is documented:http://www.freepascal.org/docs-html/rtl/classes/tstringlist.duplicates.html
But what should I do if i don't need sort?
TSortState = (ssUnsorted, ssDuplicatesIgnore, ssNoDuplicatesAccept, ssDuplicatesError);
For i:=0 to Memo1.Lines.Count-1 doif SL.IndexOf(Memo1.Lines[i])<0 then SL.Add(Memo1.Lines[i]);