codice:
<%
'recupero la lista
lista="1,5,7,6,1,2,3,10,6,152,2,6,8,7,4,5,3,2,1,0,9,8,5,3,15,12,16,18,17,11,10"
'ordine c=crescente d=decrescente
ordine="d"
'la sistemo togliendo le virgole in eccesso (prima e ultima)
if left(lista,1)="," then
lista=right(lista,(len(lista)-1))
end if
if right(lista,1)="," then
lista=left(lista,(len(lista)-1))
end if
'recupero il numero di dati contenuti
cont=split(lista,",")
cont=ubound(cont)
confronto=0
confronto_d=0
if ordine="d" then
'il confronto lo si fa rispetto al massimo dell'array
array_confronto=split(lista,",")
for i=0 to ubound(array_confronto)
if ccur(array_confronto(i))>ccur(confronto_d) then
confronto_d=ccur(array_confronto(i))
end if
next
confronto=confronto_d
end if
do while cont>-1
array_lista=split(lista,",")
for i=0 to cont
if ordine="c" then
if ccur(array_lista(i))>ccur(confronto) then
confronto=ccur(array_lista(i))
end if
elseif ordine="d" then
if ccur(array_lista(i))<ccur(confronto) then
confronto=ccur(array_lista(i))
end if
end if
next
lista=""
'elimino il valore gia preso
c=0
for i=0 to cont
if ccur(confronto)<>ccur(array_lista(i)) then
lista=lista&","&array_lista(i)
else
if c=0 then
c=c+1
else
lista=lista&","&array_lista(i)
end if
end if
next
if left(lista,1)="," then
lista=right(lista,(len(lista)-1))
end if
array_ordinato=array_ordinato&","&confronto
cont=cont-1
if confronto_d=0 then
confronto=0
else
confronto=confronto_d
end if
loop
if left(array_ordinato,1)="," then
array_ordinato=right(array_ordinato,(len(array_ordinato)-1))
end if
response.write array_ordinato
%>
funziona perchè io lo uso