ASP中一维数组如何判断是否存在重复项呢

请问一下,动态一维数组中如何判断数组中是否存在相同的值呢?
比如说动态数组A()
A(1)="A" A(2)="B" A(3)="A"
动态数组B()
B(1)=1 B(2)=2 B(3)=3

最后输出的是 A 4 B 2
就是A(1)+A(3) 相同的数组B()相加输出,不相同的直接输出B()对应的值

 a=split("A,B,A",",")
b=split("1,2,3",",")
for i = 0 to ubound(a)
    for j = i+1 to ubound(a)
        if a(i)<>"" and a(i)=a(j) then
            a(j)=""
            b(i) =cint( b(i)) + cint(b(j))
            b(j)=0
            exit for
        end if
    next
next

for i =0 to ubound(a)
  if a(i) <> "" then
    msgbox a(i) & " " & b(i)
  end if
next
 for i = 1 to ubound(a)
    for j = 1 to ubound(a)
        if a(i)=a(j) then
            b(i) = b(i) + b(j)
            b(j)=0:a(j)=""
            exit for
        end if
    next
next
for i = 1 to ubound(b)
if a(i) <> "" then
print a(i) & " " & b(i)
end if
next

a(1)会重复。。。

这样子改会不会更好点

  for i = 1 to ubound(a)
    for j = 1 to ubound(a)
        if i<>j and a(i)=a(j) then
            b(i) = b(i) + b(j)
            b(j)=0:a(j)=""
            exit for
        end if
    next
next
for i = 1 to ubound(b)
if a(i) <> "" then
print a(i) & " " & b(i)
end if
next