Sort doesn't work with descend order?
Posted: 27 Mar 2024, 00:15
Sort doesn't work with descend order? I want to sort the lines with the number at the end, and specify "NR" in Options, but it always in ascend order.
Code: Select all
Contents := "
(
wwwww=3
fffff=8
ggggg=2
)"
MsgBox Sort(Contents, "NR", NumSort)
NumSort(a1, a2, *)
{
a1 :=Number(StrSplit(a1, "=")[2])
a2 := Number(StrSplit(a2, "=")[2])
return a1 > a2 ? 1 : a1 < a2 ? -1 : 0
}