自然排序算法的实现困境 [英] Natural sort algorithm implementation woes

查看:175
本文介绍了自然排序算法的实现困境的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用Google搜索ASP经典的自然排序算法无济于事的实现。最好我能找到的是从戴夫Koelle ,这是从SO一个问题。问题是,因为我需要实现这个算法在ASP经典,我没有使用某些功能,如

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

Col​​lections.sort(你的名单,新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?

感谢你。

推荐答案

您还没有哪一种语言,你在ASP中使用指定的。通常情况下,这将是VBScript中。

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

不过,如果你使用JScript的,而不是那么你可以使用JScript中的数组对象,并使用它的排序方法。该方法任选地作为一个参数的比较器功能。

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) });

有没有需要的一切转换为JScript中,你可以用用JScript公用事业从VBScript。

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

这篇关于自然排序算法的实现困境的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆