pos = ReverseFindStr(string$, substring$[, casesen, startpos, encoding])
substring$
in string$
and returns the position of the substring.
In contrast to FindStr(), searching is done in reverse, i.e. from
the string's end to its start.
The position is returned in characters, not in bytes, starting at position 0
for the first character. If substring$
cannot be found, -1 is returned. The
optional argument casesen
allows you to specify if the search should be
case sensitive. This defaults to the global case sensitive default mode set
using IgnoreCase(). See IgnoreCase for details.
You can also specify a starting position for the search in the optional argument
startpos
. This position needs to be specified in characters, not in bytes. By
default, startpos
is set to the length of string$
in characters minus 1.
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.
string$
True
for a case sensitive search or False
for a case insensitive search; the default is True
or whatever default has
been set using the IgnoreCase() commandstring$
minus 1)substring$
in string$
in characters or -1 if not foundresult = ReverseFindStr("Hello, Hello!", "Hello") Print(result)This will print "7" because searching is done in reverse, which is why the position of the second "Hello" is returned.