Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Natural order sorting in vb

Natural order sorting in vb

Scheduled Pinned Locked Moved Visual Basic
algorithmstutorialquestion
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    herulee
    wrote on last edited by
    #1

    HELLO ALL; Does anybody have idea how to do Natural order sorting in vb e.g. If i ahev entries like 1 2 11 111 A AA B then it sors like 1 11 111 2 A AA AAA B So do u have any idea how to implement natural sort? Thanx in advance

    H L 2 Replies Last reply
    0
    • H herulee

      HELLO ALL; Does anybody have idea how to do Natural order sorting in vb e.g. If i ahev entries like 1 2 11 111 A AA B then it sors like 1 11 111 2 A AA AAA B So do u have any idea how to implement natural sort? Thanx in advance

      H Offline
      H Offline
      helelark123
      wrote on last edited by
      #2

      As you see, the sorting take in consideration the word lenght, so to get a "Natural" sorting you can formatting all the worlds to have the same lenght by concatenating 0 before each word. For example, if you have 1 2 11 111 A AA B so format them as following: 001 002 011 111 00A 0AA 00B and now sort. Hope it helps

      Shay Noy

      1 Reply Last reply
      0
      • H herulee

        HELLO ALL; Does anybody have idea how to do Natural order sorting in vb e.g. If i ahev entries like 1 2 11 111 A AA B then it sors like 1 11 111 2 A AA AAA B So do u have any idea how to implement natural sort? Thanx in advance

        L Offline
        L Offline
        Luc Pattyn
        wrote on last edited by
        #3

        You can rely on Windows Explorer to do it for you, see here[^]. :)

        Luc Pattyn


        I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages


        H 1 Reply Last reply
        0
        • L Luc Pattyn

          You can rely on Windows Explorer to do it for you, see here[^]. :)

          Luc Pattyn


          I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages


          H Offline
          H Offline
          herulee
          wrote on last edited by
          #4

          Thanx for the quick reply I thought of padding but there can be a seperator e.g A - 1 1 * A 2 # 5 which makes dificult to sort do u have any idea what can be the solution in this case? Thanx

          L 1 Reply Last reply
          0
          • H herulee

            Thanx for the quick reply I thought of padding but there can be a seperator e.g A - 1 1 * A 2 # 5 which makes dificult to sort do u have any idea what can be the solution in this case? Thanx

            L Offline
            L Offline
            Luc Pattyn
            wrote on last edited by
            #5

            either the items are valid file names and I gave you the answer already, or they aren't and you have to write code to do it yourself. :)

            Luc Pattyn


            I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages


            H 1 Reply Last reply
            0
            • L Luc Pattyn

              either the items are valid file names and I gave you the answer already, or they aren't and you have to write code to do it yourself. :)

              Luc Pattyn


              I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages


              H Offline
              H Offline
              herulee
              wrote on last edited by
              #6

              Thanx Luc I will try with P/invoke if that doesnt solve the problem then manual sorting is the the best option :doh: Thanx once again

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups