当前位置:编程学习 > asp >>

asp 过滤重复字符的代码函数

ASP清除字符中的重复字符的函数
<%
Function zzzyk(str)
dim intLen,i,strTemp,aryTest
intLen = Len(str)
strTemp = ""
aryTest = Split(str,",")
For i = LBound(aryTest) to UBound(aryTest)
If Instr(1,strTemp,aryTest(i)) = 0 Then
strTemp = Trim(strTemp) & aryTest(i) & ","
End If
Next
Test = strTemp
End Function

'调用方法:

str="站长资源库 zzzyk.com"

aa=zzzyk(str)
ss=left(aa,len(aa)-1)

response.write ss '输出ss即可 

%>

结果:

站长资源库 zyk.com

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,