This did it:
Dim l As List = File.ListFiles(folder)
l.Sort(True) 'Erel's hint
Dim lreturn As List
.etc
But: the list is i.e. ....8,9,10,100,1000,110,12,120,......
How can i solve this so the lst shows the "real" sorting ...8,9,10,11,12,13,......100,120 etc.
"Playing" with the "Sort MultilineString" from the B4J HowTo doesnt change anything:
' Parameter: The String to sort
' Returns String ASC
Sub sortMultiLineString(mls As String) As String
If mls.Length = 0 Then Return ""
' Split the text
Dim s() As String = Regex.Split(CRLF, mls)
Dim l As List
l.Initialize
l.AddAll(s)
l.sort(True)
mls = ""
For i = 0 To s.Length - 1
mls = mls & l.Get(i) & CRLF
Next
Return mls
End Sub
Example sorting Form TextArea
Private ta As TextArea
ta.Text = sortMultiLineString(ta.Text)
Adapted it to this:
private Sub getFolders(folder As String) As List
Dim l As List = File.ListFiles(folder)
' SORTIEREN
l.Sort(True) 'Erel's hint
Dim lreturn As List
lreturn.Initialize
For i = 0 To l.size - 1
Dim fName As String = l.Get(i)
fName = sortMultiLineString(fName) ' myTry
' If File.IsDirectory(folder,fName) Then
lreturn.Add(fName)
' End If
Next
Return lreturn
End Sub