Sorting Module

In the few desktop applications I’ve written so far (just a hobby, no commercial background) I often had to sort arrays of various types, and as I’ve learned over the time there are different ways to accomplish this.
Getting tired of searching my code for this kind of sorting or that, I put the different approaches in one module to “sort them all”. Maybe a more experienced programmer might feel like having a look at the module to tell me if I did do something gravely wrong. The module can be found here:

The module has two different method calls:

  1. SomeArray.SortMe >> works with arrays of the primitive types Integer and Double and internally just calls the Array’s Sort method. You can also sort String arrays, which works by a delegate method in order to have a case sensitive sorting.
  2. SomeObjectArray.SortMe(propName As String) >> sorts object arrays (using the Introspection example of the documentation) by a property of the type Integer (Int32, Int64), Double, SQLDate, SQLDateTime or Text by calling the SortWith method. It also sorts object arrays by a String property, but this was a bit more difficult for me, because the SortWith method is case insensitive when using Strings. I ended up implementing a hybrid merge sort (case sensitive), which is not as fast as a genuine Xojo method but still fast enough for me.

As I said: It is just a hobby and mainly for exercising purposes, so any remark will be helpful and welcome!

If you want a few more then have a look at (scroll down to sorting-algorithms…)

Oh, that’s very interesting. Thanks a lot!