Avoid duplicate items in string lists (Views: 704)
Problem/Question/Abstract: Avoid duplicate items in string lists Answer: var sl: TStringList; begin sl := TStringList.Create; with sl do begin Sorted := True; Duplicates := dupIgnore; // // add your items here // all the duplicate items // will be ignored // Add(Input1.text); end; // // now you can assign the // string list with unique // items to listbox1 (example) // ListBox1.Items.Assign(sl); sl.Free; end; |