Why does the following code
[code]dim test(-1) as string
test.Append “[test]”
test.Append “bla”
test.Append “blubber”
test.Sort
Beep[/code]
result in an array with “[test]” at the end and not the beginning? I recently noticed that Valentina sorts this at the beginning and Xojo at the end. The Valentina database is set to German locale, Strength = kSecondary (case-insensitive as I remember).
In Xojo I would simply use a different sort comparator but the sorting is a tiny bit more complicated:
[code]dim SortMailboxes(-1) as String
for currentMailbox as Integer = 0 to UBound(AllMailFoldersUI)
dim firstPart as String = NthField(AllMailFoldersUI(currentMailbox), globals.MailboxDivider, 1)
dim SortMailbox as String = ReplaceAll(AllMailFoldersUI(currentMailbox), globals.MailboxDivider, Chr(1))
if firstPart = “Inbox” then
SortMailboxes.Append “1:” + Lowercase(SortMailbox)
elseif firstPart = “Sent Messages” then
SortMailboxes.Append “2:” + Lowercase(SortMailbox)
elseif firstPart = “Trash” then
SortMailboxes.Append “6:” + Lowercase(SortMailbox)
elseif firstPart = “Spam” then
SortMailboxes.Append “3:” + Lowercase(SortMailbox)
elseif firstPart = “Mailboxes” then
SortMailboxes.Append “4:” + Lowercase(SortMailbox)
else
SortMailboxes.Append “5:” +Lowercase(SortMailbox)
end if
next
SortMailboxes.SortWith(AllMailfoldersUI, AllMailFolders)
[/code]
Bug or feature?
Xojo 2017r3, macOS 10.11.6, 32 and 64bit.