Last index of
Function Syntax
int last_index_of(string search ,string find )
- search in the string to search in
- find is the string you're trying to find
This function searches through the string search, looking for the string find. This function returns the position where find last occurs in search. This function returns a 0-indexed value, meaning that the first character of search counts as 0.
Code Sample
Returns the last instance of the phrase "la" in the following phrase.
last_index_of( "I'm not listening, la la la la" , "la" );
Would result in:
Returned: 28
See Also
Special
If find does not occur in search, this function returns -1.