<%
Str1 = "0,4,5,6,,9,10"
Str2 = "1,2,5,6,,9,10"
Str3 = "1,2,5,7,,9,10"
str=str1&","&str2&","&str3
a=split(str,",")
b=ubound(a)
for i=0 to b
c=0
for j=0 to b
if a(i)=a(j) then
c=c+1
if c>1 then a(j)=""
end if
next
next
str4=""
for k=0 to ubound(a)
if a(k)<>"" then
str5=str5&a(k)&","
end if
str4=str4&a(k)&","
next
str5=left(str5,len(str5)-1)
str4=left(str4,len(str4)-1)
response.write str&"<br>"&str4&"<br>"&str5
%>
<%
'*** 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,97)
MyArray = SortStr(MyArray)
For I = 0 to Ubound(MyArray)
Response.Write MyArray(I) & "" & vbCRLF
Next
Response.End
'*** Sorter Function that takes an array and sorts it
Function SortStr(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
SortStr = ary
End Function
%>
还是不对
dim a
dim c
c="," & str1 & "," & str2 & "," & str3 & ","
dim d '象楼上那样会名称重定义的,呵呵
for i=1 to 10
d="," & i & ","
if instr(1,c,d)
a=a & i & ","
end if
next
dim strb
strb=left(a,len(a)-1)
sorry!少打了一句
dim a
dim c
c="," & str1 & "," & str2 & "," & str3 & ","
for i=1 to 10
dim d
d="," & i & ","
if instr(1,c,d)
a=a & i & ","
end if
next
dim strb
strb=left(a,len(a)-1)