lastIndexOf
Retrieves the index of last occurrence of a substring in a string.
lastIndexOf(searchString, substring)
#
ParameterssearchString
: Thestring
to search withinsubstring
: Thestring
to find insearchString
#
Returns- The index within
searchString
of the last occurrence of the specifiedsubstring
.
#
Exampleprint(lastIndexOf('Happy world, healthy world', 'world')) # prints, 21