日期:2014-05-17  浏览次数:21160 次

如何写这样的函数啊
h=1
i=3,4,7,22,11,8,1,556,1211,6543,2134

如果判断i中有h的数字

------解决方案--------------------
<%
h="1"
i="3,4,7,22,11,8,1,556,1211,6543,2134"
h=","&h&","
ii=","&i&","
if instr(ii,hh)>0 then
response.write "有"
else
response.write "无"
end if
%> 

------解决方案--------------------
什么叫自己写的函数?你不用vbs,自己开发一种语言就可以了
------解决方案--------------------
<%
h=1
i=3,4,7,22,11,8,1,556,1211,6543,2134
if myInstr(i,h) then
response.write "有"
else
response.write "无"
end if

%>
<%
function myInstr(str1,str2)
temp=false
arr=split(str1,",")
for i=0 to ubound(arr)
if arr(i)=str2 then
temp=true
exit for
end if
next
myInstr=temp
function
%>
------解决方案--------------------
适合....
------解决方案--------------------
其实,二楼已经不错的了。只是写成函数而已。
------解决方案--------------------
探讨

谢谢楼上, 我说的是自己写函数 你用的instr函数我也知道, 自己写的函数有吗