搜索文章:

首页  |  Java技术  |  Asp.net  |  Asp编程  |  VC/C++  |  Delphi  |  VB编程

数组数据排序的程序例子

<%
*** build example array to show that this thing can sort
*** alpha-numeric arrays
dim myarray
myarray = array(1,5,"shawn","says","hello",123,12,98)
myarray = sort(myarray)
for i = 0 to ubound(myarray)
response.write myarray(i) & "<br>" & vbcrlf
next
response.end


*** sorter function that takes an array and sorts it
function sort(ary)
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
sort = ary
end function
%>

()

相关文章:
© 2006   www.java-asp.net