日期:2014-05-16  浏览次数:21138 次

以下循环语句还能精炼吗?
主要功能是进行两次合并重复字符串
这是昨天求助后我进行的修改
<%
Dim a:a="6,4,1,4,0,3,1"
Dim s:s = "1|2|3,1,4|5|7,1|2|4|6,5|6|7|4,1|2|3,4|5|8"
Dim b,c,d,arr,list

arr=Split(a,",")
d=Split(s,",")
list="|"
For i=0 To UBound(arr)
    If instr(list,"|"&arr(i)&"|")=0 Then
        temp=Split(a,arr(i))
        If UBound(temp)>1 Then
            sole=sole& ","&arr(i)
            For j=0 to ubound(arr)         
if  arr(i)=arr(j)  and j>i  then  
b=MoveR("|"&d(i)&"|"&d(j))
c=c&","&b 
end if
next
Else
            c=c&","&d(i)
sole=sole&","&arr(i)

        End If

    list=list&arr(i)&"|"
    End If

Next
response.write Mid(sole,2)&"<br/>"
response.write Replace(Mid(c,2),",|",",")&"<br/>"
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(MoveR,SpStr(i))=0 Then 
    MoveR = MoveR & SpStr(i) & "|" 
   End If 
  End If 
 Next 
End Function
 
%>

------解决方案--------------------
大概明白了意思。
<%
Function remove_duplicate(s_array,sign)