<% arra = "15,19,210,22,45,6,55" arrb = "368,111,20,501,22,66,90,55,10" arra = Split(arra, ",") arrb = Split(arrb, ",") Set dic = CreateObject("Scripting.Dictionary") For i = 0 To UBound(arra) If dic.Exists(arra(i)) Then dic.Remove arra(i) Else dic.Add arra(i), arra(i) End If Next For i = 0 To UBound(arrb) If dic.Exists(arrb(i)) Then dic.Remove arrb(i) Else dic.Add arrb(i), arrb(i) End If Next arr = dic.Items Set dic = Nothing Response.Write Join(arr, ",") %>
下面的方法更简单一些
<% dim a,b,ar,d,i a = "15,19,210,22,45,6,55" b = "368,111,20,501,22,66,90,55,10" ar = split(a & "," & b, ",") set d = CreateObject("Scripting.Dictionary") For i = 0 to UBound(ar) If d.exists(ar(i)) Then d.remove ar(i) Else d.add ar(i), ar(i) End If Next ar = d.items set d = nothing response.write join(ar, ",") %>
时间: 2024-10-08 23:02:38