PDA

View Full Version : Array Sort- issue



ReneMiner
03-11-2015, 13:29
If i do some


Array Sort ..., AsFiles

(see images, check filelist low-left)

on a string-array (that contains filenames) it does not ignore LCase/Ucase but sorts the filenames starting with UCase-chars, thereafter follow the filenames starting with LCase-chars in most cases.

Sometimes it does not even follow that rule but messes up the order completely. (image 2, where i sort standard previously and then AsFiles)
I found out that it sorts by LENGTH if using Ascend or Descend

Is there a way to simply sort by alphabet - no matter if UCase or LCase-char?
( Collate Ucase ??? ;) )

Another example:
Help says





A standard order would sort the above list in the following way
While using ASFILES it will sort considering the numeric part be a number


Picture1.jpg
Picture10.jpg
Picture11.jpg
Picture12.jpg
Picture2.jpg
Picture3.jpg
Picture4.jpg
Picture5.jpg
Picture6.jpg
Picture7.jpg
Picture8.jpg
Picture9.jpg
Picture1.jpg
Picture2.jpg
Picture3.jpg
Picture4.jpg
Picture5.jpg
Picture6.jpg
Picture7.jpg
Picture8.jpg
Picture9.jpg
Picture10.jpg
Picture11.jpg
Picture12.jpg




but in case one filename (or common string) starts with a lower-case "p" it will get sorted to the end mostly.

ErosOlmi
03-11-2015, 22:14
Let me check what I can do.
Maybe I can add COLLATE UCASE ...

ErosOlmi
04-11-2015, 00:05
Rene,

try attached 1.9.16.1 thinCore.dll (copy into your \thinBasic\ directory replacing your current one).
I've added Collate Ucase option to Array Sort and also adjust AsFiles option that I think had a bug.

If all OK I will publish an update: 1.9.16.2
Let me know.

Ciao
Eros



Examples of new syntax. If you DEBUG and step by step inspect sourceArray array you will see the difference:

Uses "Console"

Dim sourceArray(10) As String

Array Assign sourceArray(1) =
"tUI.tBasicU",
"tNode.tbasicu",
"tMouse.tBasicU",
"tWindow.tBasicU",
"Fontslot.tBasicU",
"Settings.tBasicU",
"tControl_Label.tBasicU",
"tControl_PopUp.tBasicU",
"tControl_Button.tBasicU",
"tDesktop.tBasicU"

Array Sort sourcearray(), Collate Ucase, AsFiles
Array Sort sourcearray(), Collate Ucase, Descending, AsFiles
Array Sort sourcearray(), Collate Ucase

Array Assign sourceArray(1) =
"tUI10.tBasicU",
"tUI1.tBasicU",
"tUI2.tBasicU",
"tUI3.tBasicU",
"tUI4.tBasicU",
"tUI22.tBasicU",
"tUI6.tBasicU",
"tUI7.tBasicU",
"tUI8.tBasicU",
"tUI5.tBasicU"

Array Sort sourcearray(), Collate Ucase, Ascending, AsFiles
Array Sort sourcearray(), Collate Ucase, Descending, AsFiles
Array Sort sourcearray(), Collate Ucase, AsFiles
Array Sort sourcearray(), Collate Ucase
Array Sort sourcearray(), Descending
Array Sort sourcearray()

Print "---All done---"
WaitKey

ReneMiner
04-11-2015, 00:41
That looks much better, mille grazie :)