[Delphi] AddString negeert Duplicates instelling?

Pagina: 1
Acties:

  • Icelus
  • Registratie: Januari 2004
  • Niet online
Delphi:
1
2
3
4
5
6
7
8
9
10
11
12
var  S1, S2:TStringList;
begin
     S1 := TStringList.Create;
     S2 := TStringList.Create;

     S1.Add( 'Test' );

     S2.Duplicates := dupIgnore;
     S2.AddStrings( S1 );
     S2.AddStrings( S1 );

     ShowMessage( IntToStr( S2.Count ) );
Bovenstaande code levert een dialoogvenster met de melding '2' op.
Klopt het dat de instelling van Duplicates wordt genegeerd wanneer de methode AddStrings wordt gebruikt? (werkt alleen met methode Add?)

Developer Accused Of Unreadable Code Refuses To Comment


  • Creepy
  • Registratie: Juni 2001
  • Nu online

Creepy

Tactical Espionage Splatterer

dupIgnore en dupError werken alleen als je stringlist ook gesorteerd is.
Delphi:
1
S2.Sorted := true;

"I had a problem, I solved it with regular expressions. Now I have two problems". That's shows a lack of appreciation for regular expressions: "I know have _star_ problems" --Kevlin Henney


  • Icelus
  • Registratie: Januari 2004
  • Niet online
Dat scheelt inderdaad, bedankt.

Developer Accused Of Unreadable Code Refuses To Comment


  • Creepy
  • Registratie: Juni 2001
  • Nu online

Creepy

Tactical Espionage Splatterer

Icelus schreef op 11 augustus 2004 @ 17:33:
Dat scheelt inderdaad, bedankt.
Staat gewoon in de helpfile bij de duplicates property uitgelegd. De F1 toets in Delphi is je beste vriend ;)

"I had a problem, I solved it with regular expressions. Now I have two problems". That's shows a lack of appreciation for regular expressions: "I know have _star_ problems" --Kevlin Henney