Core Function LastIndexNotOfAny
LastIndexNotOfAny( <expression>, <needle>, <pos>, <case>, <count> )
Contents |
Description
Reports the index of the last none occurrence of any characters or array of strings in a specified string.
Parameters specify the starting search position in the current string and the type of search to use for the specified string.
expression
The string to use.
needle
The characters to not find OR an array of strings not to find.
pos
Optional; Position to start the search from within the expression.
Default: expression length - 1
case
Optional; Case sensitive option
false = Case sensitive search
true = Case insensitive search
Default: false
count
Optional; The amount of characters to check before quitting the search
Default: pos + 1
Return Value
Success: Returns position of the last found character in the string that does not match the needle.
Failure: Returns -1.
Remarks
It a match is found when using a string needle it will skip that many characters before continuing the search to avoid it stopping inside a partial match.
Example
Case sensitive
// Find string println( LastIndexNotOfAny("The quick brown dog FoX cat", "cat") ); println( LastIndexNotOfAny("The quick brown cat dog FoX", "FoX") ); println( LastIndexNotOfAny("The quick brown FoX cat dog", "dog") ); say ""; // Find array of string println( LastIndexNotOfAny("The quick brown dog FoX cat", array("FoX", "cat", "dog")) ); println( LastIndexNotOfAny("The quick brown cat dog FoX", array("FoX", "cat", "dog")) ); println( LastIndexNotOfAny("The quick brown FoX cat dog", array("FoX", "cat", "dog")) );
Case insensitive
// Find string my $str = "The quick brown dog FoX cat"; println( LastIndexNotOfAny($str, "cat", strlen($str), true) ); my $str = "The quick brown cat dog FoX"; println( LastIndexNotOfAny($str, "FoX", strlen($str), true) ); my $str = "The quick brown FoX cat dog"; println( LastIndexNotOfAny($str, "dog", strlen($str), true) ); say ""; // Find array of string my $str = "The quick brown dog FoX cat"; println( LastIndexNotOfAny($str, array("FoX", "cat", "dog"), strlen($str), true) ); my $str = "The quick brown cat dog FoX"; println( LastIndexNotOfAny($str, array("FoX", "cat", "dog"), strlen($str), true) ); my $str = "The quick brown FoX cat dog"; println( LastIndexNotOfAny($str, array("FoX", "cat", "dog"), strlen($str), true) );