Dim?i,?int1(3),?str1(3),?s
int1(0)?=?22
int1(1)?=?14
int1(2)?=?6
int1(3)?=?13
Call?sortFigu(int1)'調用過程進行處理
For?i?=?LBound(int1)?To?UBound(int1)
s?=?s?&?CStr(int1(i))?&?"?"
Next
MsgBox?s'顯示int1排序後的結果
str1(0)?=?"d"
str1(1)?=?"a"
str1(2)?=?"j"
str1(3)?=?"b"
Call?sorString(str1)'調用過程進行處理
s?=?""
For?i?=?LBound(str1)?To?UBound(str1)
s?=?s?&?CStr(str1(i))?&?"?"
Next
MsgBox?s'顯示str1排序後的結果
Private?Sub?sortFigu(ByRef?int1)'數字數組升序排序
Dim?i,?j,?temp
For?i?=?LBound(int1)?To?UBound(int1)
For?j?=?i?To?UBound(int1)
If?int1(i)?>?int1(j)?Then
temp?=?int1(i)
int1(i)?=?int1(j)
int1(j)?=?temp
End?If
Next
Next
End?Sub
Private?Sub?sorString(ByRef?str1)'字符數組降序排序
Dim?i,?j,temp
For?i?=?LBound(str1)?To?UBound(str1)
For?j?=?i?To?UBound(str1)
If?str1(i)?<?str1(j)?Then
temp?=?str1(i)
str1(i)?=?str1(j)
str1(j)?=?temp
End?If
Next
Next
End?Sub
'以上只是個演示,裏面的兩個過程妳可以放到妳的網頁中調用