How ASP two arrays are compared, reject the same, keep different

Source: Internet
Author: User

<%arra = "15,19,210,22,45,6,55" ARRB = "368,111,20,501,22,66,90,55,10" ARRA = Split (Arra, ",") ARRB = Split (ARRB, ",") Se T 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 ifnextfor i = 0 to UBound (ARRB)    If dic. Exists (ARRB (i)) then        DiC. Remove ARRB (i)    Else        dic. Add ARRB (i), ARRB (i)    End Ifnextarr = dic. Itemsset dic = Nothingresponse.write Join (arr, ",")%>

The following method is simpler

<%dim A,b,ar,d,ia = "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< C3/>d.add ar (i), AR (i)    End Ifnextar = d.itemsset d = nothingresponse.write join (AR, ",")%>

  

 

How ASP two arrays are compared, reject the same, keep different

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.