欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

asp数字或者字符排序函数代码

程序员文章站 2022-08-05 20:50:41
复制代码 代码如下: '排序 function sort1(ary) dim keepchecking,i,firstvalue,secondvalue keepcheck...
复制代码 代码如下:

'排序
function sort1(ary)
dim keepchecking,i,firstvalue,secondvalue
keepchecking = true
do until keepchecking = false
keepchecking = false
for i = 0 to ubound(ary)
if i = ubound(ary) then exit for
if ary(i) > ary(i+1) then
firstvalue = ary(i)
secondvalue = ary(i+1)
ary(i) = secondvalue
ary(i+1) = firstvalue
keepchecking = true
end if
next
loop
sort1 = ary
end function

dim arr
arr = array("a","c","b")
arr = sort1(arr)
for i=0 to ubound(arr)
response.write(arr(i)&"<br />")
next