The lastIndexOf(...) function has two variations, not counting syntax variations. It searches for one String value within another String value beginning at the end and working toward the beginning of the source-string. It can optionally be instructed to begin searching at a particular character index position. The lastIndexOf(...) function returns -1 if no match is found. If a match is found, it returns the index position of the first character in the matching sub-string. If either of the two input Strings is null, then the result will also be null. If the start-index is null or not present then the function will search from the end.

Syntax:
lastIndexOf( source-string, target-string )
lastIndexOf( source-string, target-string, start-index )
source-string.lastIndexOf( target-string )
source-string.lastIndexOf( target-string, start-index )

Parameter Description
source-string

The String within which to search, beginning at the end (or start-index) and working toward the beginning. 

target-string

The String for which to search. 

start-index

The index of the character at which to begin searching.