I was wondering how to sort an arraylist properly from highest to lowest value when textual content is added rather than numerical.
When I add integer values instead:
a1.Add(20)
a1.Add(112)
a1.Add(4)
a1.Add(11)
things are sorted well: 112 / 20 / 12 / 4.
Is there a way to get this second type of sorting with textual content too?
Code:
Dim a1 As New ArrayList
a1.Add("20 Items")
a1.Add("112 Items")
a1.Add("4 Items")
a1.Add("11 Items")
a1.Sort()
a1.Reverse()
For Each i In a1
MsgBox(i)
Next
' Results: 4 Items / 20 Items / 112 Items / 11 Items
a1.Add(20)
a1.Add(112)
a1.Add(4)
a1.Add(11)
things are sorted well: 112 / 20 / 12 / 4.
Is there a way to get this second type of sorting with textual content too?