AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

TStringList absteigend sortieren?

Ein Thema von design5 · begonnen am 20. Jan 2003 · letzter Beitrag vom 24. Jan 2003
 
Daniel
(Co-Admin)

Registriert seit: 30. Mai 2002
Ort: Hamburg
13.920 Beiträge
 
Delphi 10.4 Sydney
 
#6
  Alt 20. Jan 2003, 11:03
Hallo,

erstmal willkommen in der Delphi-PRAXiS.

Die Stringliste bietet Dir die Eigenschaft 'CustomSort' an, mit welcher Du sie in einer von Dir gewünschten Reihenfolge sortieren kannst.

Zitat von Delphi-Hilfe:
Sorts the strings in the list in a customized order.

Delphi-Quellcode:
type TStringListSortCompare = function(List: TStringList; Index1, Index2: Integer): Integer;
procedure CustomSort(Compare: TStringListSortCompare); virtual;
Description:
Use CustomSort to sort the strings in the list, where the sort order is defined by the Compare parameter.

Supply a value for the Compare function that compares two strings in the string list. The List parameter provides access to the string list, while the Index1 and Index2 parameters identify the strings to be compared. Use Index1 and Index2 as indexes into the Strings property array. The Compare function should return

a value less than 0 if the string identified by Index1 comes before the string identified by Index2
0 if the two strings are equivalent
a value greater than 0 if the string with Index1 comes after the string identified by Index2.
Do not pass nil as the value of the Compare parameter.

Note: You must explicitly call the CustomSort method. Setting the Sorted property only sorts strings using ANSI order, as implemented in the Sort method.
Daniel R. Wolf
mit Grüßen aus Hamburg
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 04:21 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz