日期:2011-12-22  浏览次数:20978 次

<%

'======================================
'作者:爱易学习网
'时间:2005.12.20
'作用:去除数组中重复的项
'======================================
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
str1 = "abc,abc,dge,gcg,dge,dgi,die,dir,fgk,dir,gis,sgier,ssir"
response.write MoveR(str1)
%>

如果需要得到重复值的匹配率,只要在End Funciton前一句加上以下代码:

MoveR = FormatPercent(InNum/Ubound(split(MoveR,",")))

就可以得出重复值的匹配率了!