n = CountStr(s$, sub$[, casesen, startpos, encoding])
sub$ inside s$. The
optional argument casesen specifies whether or not the strings shall
be compared in a case sensitive manner. Furthermore, you can use the
startpos argument to specify an offset into s$ at which CountStr() should
start counting. This offset is in characters, not in bytes. Position 0 means
the beginning of the string.
The casesen parameter defaults to the global case sensitive default mode set
using IgnoreCase(). See IgnoreCase for details.
The optional encoding parameter can be used to set the character encoding
to use. This defaults to the default string encoding set using SetDefaultEncoding().
See Character encodings for details.
s$True if the case in s$ must match the
case setting in sub$; the default is True or whatever default has
been set using the IgnoreCase() commands$ to start the search (defaults to 0)sub$ inside s$
ret = CountStr("What is that on your head? Is that a new hat? " ..
"You have not had that on our last chat!", "hat")
The above code should return 6 because "hat" occurs 6 times in the
source string.