Results 1 to 3 of 3

Thread: Sorting alpha lists wierdness

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2004
    Location
    buffalo, ny
    Posts
    18

    Sorting alpha lists wierdness

    Hi everyone,
    I'm writing a utility to clean up emails and I need to sort a list of up to about 40000 items.

    At first I tried putting these items in a sorted listbox this worked well, but then I noticed the list was like this:

    AB
    AB
    AB
    ab
    ab
    ab
    AB
    ABC
    etc..

    Where uppercase/lowercase of the same characters were mixed together. I did a bubble sort which corrects this but is super slow. I did a shell sort and quick sort and it is very fast but sorts similarly to the listbox sort. (upper and lower mixed)

    I trimmed the strings before putting them in an array, so they are all of the same length.

    What am I doing wrong?

    thanks for your help!
    m.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Sorting alpha lists wierdness

    If you put a UCase or an LCase on the List1.Additem entry as you were adding it, then when they got to your listbox that issue would not be present.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    May 2004
    Location
    buffalo, ny
    Posts
    18

    Re: Sorting alpha lists wierdness (RESOLVED)

    Hey Hack,
    That does work, but I need the data in the original format.

    I stumbled on the solution.

    Here's what I'm doing
    1) place unsorted data in an array
    2) sort the array (using bubblesort or other)
    3) place array elements in a list box

    If the listbox has sorted = true it sorts as I stated above. If sorted = false they are sorted perfectly. I have no idea why this would be, I assumed the sort routines were to blame, they worked perfectly.

    It would be cool if someone could explain why this works this way, but I got by the problem....
    m.

Posting Permissions

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



Click Here to Expand Forum to Full Width