asp如何实现两个数组的比较,如果数组字符相同则过滤,不相同则把数组记录返回?
比如:
数组一:
a(0) = "aaa "
a(1) = "bbb "
a(2) = "ccc "
数组二:
b(0) = "aaa "
b(1) = "lll "
b(2) = "ccc "
怎么些循环使这两个数组记录一一做比较呢,也就如下:
a(0) = b(0)
a(1) = b(1)
a(2) = b(2)
如果字符不相等,则返回该变量,把不相同的变量放到新的一个数组c()中
------解决方案--------------------Dim a(2), b(2)
a(0) = "aaa "
a(1) = "bbb "
a(2) = "ccc "
b(0) = "aaa "
b(1) = "lll "
b(2) = "ccc "
Set dic = CreateObject( "Scripting.Dictionary ")
For i=0 To UBound(a)
If a(i) <> b(i) Then dic.Add a(i), b(i)
Next
c = dic.Items
d = dic.Keys
For i = 0 To UBound(c)
Response.Write c(i)
Next