Results 1 to 4 of 4

Thread: Array Sort- issue

  1. #1
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    54
    Posts
    1,528
    Rep Power
    170

    Array Sort- issue

    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.
    Attached Images Attached Images
    Last edited by ReneMiner; 03-11-2015 at 15:08.
    I think there are missing some Forum-sections as beta-testing and support

  2. #2
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    Let me check what I can do.
    Maybe I can add COLLATE UCASE ...
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  3. #3
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    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
    
    Attached Files Attached Files
    Last edited by ErosOlmi; 10-10-2017 at 08:05.
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  4. #4
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    54
    Posts
    1,528
    Rep Power
    170
    That looks much better, mille grazie
    Attached Images Attached Images
    Last edited by ReneMiner; 04-11-2015 at 11:00.
    I think there are missing some Forum-sections as beta-testing and support

Similar Threads

  1. copy array of UDT to another array in one step?
    By ReneMiner in forum thinBasic General
    Replies: 3
    Last Post: 02-11-2012, 01:15
  2. Replacing ARRAY SORT
    By MikeTrader in forum Power Basic
    Replies: 9
    Last Post: 28-08-2009, 22:57
  3. TBJ: little section for next issue
    By ErosOlmi in forum Suggest new articles
    Replies: 2
    Last Post: 27-07-2008, 09:12
  4. PCOPY! Issue #70 now available.
    By MystikShadows in forum PCOPY!
    Replies: 5
    Last Post: 20-06-2008, 20:50

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •