ASP判断变量其中一部分

来源:百度知道 编辑:UC知道 时间:2024/06/30 19:45:21


n=dfljsdlfj99fsflkj

if n=99then
response.write "含有99"
else
response.write "不含99"
end if

怎么样才能判断出N中包含不包含99

n=dfljsdlfj99fsflkj

if instr(n,"99")>0 then
response.write "含有99"
else
response.write "不含99"
end if

if instr(n,"99")>0 then print "n里面有99"

判断字符串要用双引号引起来才行,楼上的和你的都不能正确判断,正确如下:

<%
n="dfljsdlfj99fsflkj"

if instr(n,"99")>0 then
response.write "含有99"
else
response.write "不含99"
end if
%>