當前位置:成語大全網 - 新華字典 - ASP 合並數組

ASP 合並數組

我收集的壹段代碼,妳修改下也許可以實現。

除去數組中重復的內容

<%

'除去數組中重復的內容

Dim NewArr()

ReDim Preserve NewArr(0)

NewArr(0) = oldArr(0)

for i = 1 to UBound(oldArr)

MatchArray = Filter(NewArr, oldArr(i), True,1)

iRepeatFlag = 1

For j = 0 To UBound(MatchArray)

iRepeatFlag = StrComp(oldArr(i), MatchArray(j), 1)

'壹旦發現重復,立刻退出循環

If iRepeatFlag = 0 Then

Exit For

End If

Next

If IsNull(iRepeatFlag) Then iRepeatFlag = 2

If iRepeatFlag <> 0 Then

ReDim Preserve NewArr(UBound(NewArr) + 1)

NewArr(UBound(NewArr)) = oldArr(i)

End If

next

'顯示除去重復內容後的結果

for each a in NewArr

response.write a&"<br>"

next

%>