I has some trouble in sorting the scores of a game using simple and yet complicated sort function of lists.
The sort function sorts correctly as long as all elements are same type : strings or number
The following code sorts the scores , that you could save aferwards on you sd card as list of strings.
The sort function sorts correctly as long as all elements are same type : strings or number
The following code sorts the scores , that you could save aferwards on you sd card as list of strings.
B4X:
For i=0 To rank.Size-1
Dim temp As Int
temp=rank.Get(i)
rank.RemoveAt(i)
rank.InsertAt(i,temp)
Next
rank.Sort(True) 'sorts ascending the list
diplay_rank ' function to display the list