关于在ASP中字符串排序的问题
aaa="9,13,8,21,25,"
s = split(aaa,",")
for i=0 to ubound(s)-1
min=i
For j=i+1 To ubound(s)
If CInt(s(min))>CInt(s(j)) Then
min=j
End if
tem=s(i)
s(i)=s(min)
s(min)=tem
Next
pid=pid+s(min)+","
Next
我想把字符串aaa进行排序(小到大),可是有问题,不知哪儿不对,请高手帮忙看一下,如果可以帮我改一下代码。谢谢!
参考答案:aaa="9,13,8,21,25"
s = split(aaa,",")
for i=0 to ubound(s)
min=i
For j=i+1 To ubound(s)
If CInt(s(i))>CInt(s(j)) Then
min=j
End if
tem=s(i)
s(i)=s(min)
s(min)=tem
Next
pid=pid+s(i)+","
Next
response.Write(pid)