asp 判断 一个字符串中是否含有如'北京',如何写?

来源:百度知道 编辑:UC知道 时间:2024/05/21 17:00:33
asp 判断 一个字符串中是否含有如'北京',如何写?
是不是用regex
或正则来表达!
急!
谢谢!
能不能写出一个函数来!~
高分悬赏~!

<%
sub searchWord(strTarget,strWord)
'strTarget是主串,strWord是要查找的字串
if strTarget="" or strWord="" then exit sub
if InStr(strTarget,strWord)>0 then
Response.write "包含"
else
Response.write"不包含"
end if
end sub

'调用
call searchWord("北京2008年奥运会","北京")
%>

dim str

str="中国北京人民大会堂"
if InStr(str,"北京")>0 then
Response.write"包含"
else
Response.write"不包含"
end if