Asp判断字符在字符串中重复次数:
<%
function getCount(express,defaultValue)
count=0
temp=split(express,",") '分隔符
for i=0 to ubound(temp)
if temp=defaultValue then count=count+1
next
getCount=count
end function
response.write getCount("1,2,3,1,2,1,1,1","2") '字符串,查找字符
%>
<%
Function getCount(s,subs)
temp = s
count= 0
while(instr(s,subs)>0)
response.write s & "<BR>"
count = count + 1
s = right(s,len(s) - instr(s,subs))
Wend
getCount = count
End Function
s = "我们建议这样做好,他们不建议这样做!怎么办?"
subs="建议"
response.write getCount(s,subs)
%> |