Sort lists and tables
The DSort function sorts the elements of a list or table according to their values in descending order.
In the case of a table, the number of a column can be optionally specified according to which the rows are sorted. If no column is specified, the values are sorted line by line.
DSort (list)
DSort (table, column)
a=Rnd(New(12, 20))
a= 4 0 18 8 10 6 8 3 7 15 12 12
DSort(a)=18 15 12 12 10 8 8 7 6 4 3 0
Ungültige Werte, z.B. Unendlich oder Texte werden unsortiert an das Ende der Liste gesetzt.
b = [1,3,6,-1,(1/0),8,2]
b=1 3 6 -1 ∞ 8 2
DSort(b)=8 6 3 2 1 -1 ∞
In Tabellen wird Zeilenweise von links nach rechts absteigend sortiert, wenn keine Spalte angegeben wird
If a column number is specified, the rows are sorted by the values in the specified column. The order in the individual lines is not changed.