SoFunction
Updated on 2025-04-08

How to detect the number of times a string appears?

Function CheckTheChar(TheChar,TheString)
' TheChar="
String to be detected".
' TheString="
The string to be detected".
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="
This character"&CheckTheChar&"Second-rate"
else
CheckTheChar="0
Second-rate"
end if
End Function