Built-in Functions → findLast
findLast() is a string function that returns the index of the last occurrence of a string within another string.
Note
The offset is based on a zero index, findLast() returns the offset where the match is found. If there is no match, findLast() returns -1.
Signature
findLast(string exp1,string exp2)
The following table illustrates the findLast() parameters:
Parameter | Description |
---|---|
string exp1 | the string to search for |
string exp2 | the string to be searched |
Returns
int
Example
Find the index of the last "a" in "banana".
findLast("a", "banana")
This example returns 5.