<%function MoveR (Rstr) Dim i,spstr spstr = Split (Rstr, ",") for i = 0 to Ubound (spstr) If i = 0 Then MoveR = MoveR & Spstr (i) & "," Else If InStr (Mover,spstr (i)) =0 and I=ubound (spstr) Then MoveR = MoveR & Spstr (i) Elseif InStr (Mov Er,spstr (i)) =0 then MoveR = MoveR & Spstr (i) & "," End If End If Next end Function%>
Pp=mover ("Abc,abc,dge,gcg,dge,gcg,die,dir,die")
' PP returns fruit Abc,dge,gcg,die,dir
Pp1=ubound (Split (MoveR (PP), ","))
' PP1 returns fruit 5
If two arrays are compared, the same array elements are removed:
<%function Mover (farray,sarray) a = Split (Farray, ",") Set dic = CreateObject ("Scripting.Dictionary") for k= 0 to UBound (a) If a (k) <> "then dic. Add "_" & A (k), a (k) Next a = Split (Sarray, ",") for k=0 to UBound (a) if a (k) <> "" Then if D Ic. Exists ("_" & A (k)) then DiC. Remove "_" & A (k) End If End If Next items = dic. Items () Set dic = Nothing mover=join (items, ",") End Functionn1 = "a,b,1,11,12,13,14,15,16,17,19,20,22" N2 = "A , 1,12,14,18,19,20 "Response.Write Mover (N1,N2)%>
The result is: 3. There are empty elements in array a (such as A=array ("ww", "SS", "", "DD", "", "ee"),
You want to remove these empty elements from array A and assign an array of empty elements to array B.
Str= "" For i = LBound (a) To UBound (a) if a (i) <> "" ThenIf I<>lbound (a) then str = str + "," End ifstr = str & A (i) End IFNEXTB = Split (str, ",")
The method by which the ASP goes down the duplicate items in the divisor group