Core Function LastIndexNotOf

From Sputnik Wiki
Jump to: navigation, search
LastIndexNotOf( <expression>, <needle>, <pos>, <case>, <count> )

Contents

Description

Reports the index of the last none occurrence of the specified string in the current 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 string 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 last position of the found string 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 characters
println(   LastIndexNotOf("FoX The quick brown FoX", "F")   );
// Find string
println(   LastIndexNotOf("cat The quick brown FoX cat", "cat")   );
println(   LastIndexNotOf("FoX The quick brown FoX cat", "FoX")   );
println(   LastIndexNotOf("FoX The quick brown FoX", "brown FoX")   );

Case insensitive

// Find characters
my $str = "FoX The quick brown FoX";
println(   LastIndexNotOf($str , "F", strlen($str) - 1, true)   );
// Find string
my $str = "cat The quick brown FoX cat";
println(   LastIndexNotOf("cat The quick brown FoX cat", "cat", strlen($str) - 1, true)   );
my $str = "FoX The quick brown FoX cat";
println(   LastIndexNotOf("FoX The quick brown FoX cat", "FoX", strlen($str) - 1, true)   );
my $str = "FoX The quick brown FoX";
println(   LastIndexNotOf("FoX The quick brown FoX", "brown FoX", strlen($str) - 1, true)   );
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox