专注于互联网--专注于架构

最新标签
网站地图
文章索引
Rss订阅

首页 »Asp教程 » 字符串:用划界字符列表来得到字符所在串的位置 »正文

字符串:用划界字符列表来得到字符所在串的位置

来源: 发布时间:星期四, 2008年9月25日 浏览:155次 评论:0
<%
\' 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,\"-\")
%>

相关文章

读者评论

  • 共0条 分0页

发表评论

  • 昵称:
  • 内容: