Hallo,
erstelle ein record type
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20:
| type tSort : record packed pString : pCHar; Index : integer; end; var arrSort : Array of tSort; begin setlength(arrSort,mySTrList.COunt); For i := 0 to mySTrList.COunt do with arrPchar[i] do begin pString := pChar(mySTrList[i]); Index := i; end; Quicksort(arrSort,0,High(arrSort)); For i := 1 to high(arrSort) do if strComp(arrSort[i-1].pString,arrSort[i].pString)=0 then myStrList.delete(arrSort[i-1].Index); |
Ich glaube nicht, dass dies unglaublich viel schneller ist, als eine zweite Stringliste zu nehmen, dieser mittels Assign eine Kopie zuzuweisen und als Object referenz einfach den Index zuzuweisen, der dann automatisch beim sortieren beim String verbleibt.
Gruss Horst
P.S.:
Sind die zwei Schleifen denn so langsam bei den paar Strings?