用划界字符列表来得到字符所在串的位置(ListFind函数)

web学习吧 2006-12-16 来源: 收藏本文
<%
' Company: Sabra Inc
' Author: Dave Hoffenberg
' Function: Finds a value within a delimited list
' Freeware

Function ListFind(value,list,delim)

If list <> "" Then

arr = split(list,delim)

For i=0 to ubound(arr)

If arr(i) = value Then
Match = 1
Exit For
Else
Match = 0
End If

Next

ListFind = Match

Else

ListFind = 0

End If

End Function

strList = "1,2,3"
response.write ListFind("1",strList,",")

response.write "<br>"

strList = "a-b-c"
response.write ListFind("a",strList,"-")
%>

关于我们 - 免责声明 - 版权所有 - 广告服务 - 友情连接 - 商务合作 - 联系我们