1个回答
展开全部
Function CheckTheChar(TheChar,TheString)
'TheChar="要检测的字符串"
'TheString="待检测的字符串"
if inStr(TheString,TheChar) then
for n =1 to Len(TheString)
if Mid(TheString,n,Len(TheChar))=TheChar then
CheckTheChar=CheckTheChar+1
End if
Next
CheckTheChar="这个字符"&CheckTheChar&"次"
else
CheckTheChar="0次"
end if
End Function
第二种:
<%
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)
%>
'TheChar="要检测的字符串"
'TheString="待检测的字符串"
if inStr(TheString,TheChar) then
for n =1 to Len(TheString)
if Mid(TheString,n,Len(TheChar))=TheChar then
CheckTheChar=CheckTheChar+1
End if
Next
CheckTheChar="这个字符"&CheckTheChar&"次"
else
CheckTheChar="0次"
end if
End Function
第二种:
<%
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)
%>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询