views:

138

answers:

1

I have Googled ASP Classic implementations of the natural sort algorithm to no avail. Best I was able to find was from Dave Koelle, which was from a question on SO. Issue is that since I need to implement this algorithm in ASP Classic, I don't have access to certain functions such as

Collections.sort(your list, new AlphanumComparator());

Ideally, I'd like to pass an array to a function and have it return to me the ordered array.

Any ideas as to what I could do?

Thank you.

+2  A: 

You haven't specified which language you are using in ASP. Typically this would be VBScript.

However if you were to use JScript instead then you can use JScript's array object and use its sort method. This method optionally takes as a parameter a comparator function.

 var a = new Array();
 // code to populate array

 a.sort(function() { // Comparator code returning (-1|0|1) });

There is no need to convert everything to JScript, you can use utilities written in JScript from VBScript.

AnthonyWJones
Didn't think of that. Thank you.
Mike