asp 如果检查某段文中有关键字?

来源:百度知道 编辑:UC知道 时间:2024/06/18 00:39:19
例如:
<%
d1="我是出生于中国,现在在深圳."
d2="我现在在深圳,我是中国人."
%>
用什么样的方式能够判断出d1,d2中有关键字“深圳”呢,有没有函数?

if instr(d1,"深圳") > 0 then
Response.Write "d1中包含关键字""深圳""<br>"
end if

if instr(d2,"深圳") > 0 then
Response.Write "d2中包含关键字""深圳""<br>"
end if

instr

没找到:instr(d1,"深圳")=0

<%
if instr(d1,"深圳") > 0 then
Response.Write "d1中包含关键字""深圳""<br>"
end if
if instr(d2,"深圳") > 0 then
Response.Write "d2中包含关键字""深圳""<br>"
end if
'----------------------------------
if Replace(d1,"深圳","")=id1 then
Response.Write "不含关键字""深圳""<br>"
end if
if Replace(d2,"深圳","")=id2 then
Response.Write "不含关键字""深圳""<br>"
end if
%>