您现在的位置是:网站首页> 编程资料编程资料
如何检测字符串出现的次数?_编程10000问_
2023-05-25
374人已围观
简介 如何检测字符串出现的次数?_编程10000问_
如何检测字符串出现的次数?
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
