Well, the SIMPLE way to do 1/2 of it, is to put the values in a listbox (with the property sorted set to true). BUT, I know you are looking for a sorting algorithm so you can reverse the process as well. If you google sorting arrays, you will find a lot of hints. I am sure someone will gin up something for you as well...I will if I have time....busy right now.
While you could go shopping in the CodeBank here for a thread covering many common sorting algorithms, it sounds like all you need is simple sorting of String arrays.
One algorithm that is fast and doesn't have the risk of nasty worst-case performance and possible self-destruction (I'm looking at you, Quick Sort) is the Heap Sort. I have one with both ascending and descending sorts and several compare options: Binary, Text, and "Insensitive."
The risk with a Text comparison is that some differing characters compare lexically as equal even though they are different, and characters such as hyphens and apostrophes can be ignored as insignificant. However "Insensitive" compares is the slowest of the three options.
Most of the size of the attachment is due to included sample data.
Last edited by dilettante; May 1st, 2014 at 11:37 AM.
When I tried to test the sample above each time a run-time error appears. The app requires a reference to "Edanmo's OLE interfaces & functions v1.81" ... It seems this reference is not related to the sort function in any way as long as once it is eliminated everything works properly.
Last edited by Daniel Duta; May 1st, 2014 at 05:26 AM.