Learn R Programming

pystr (version 2.0.0)

pystr_rfind: Find the highest index of a substring.

Description

Return the higest index in the string where substring sub is found, such that sub is contained in the slice substr(str, start, end).

Usage

pystr_rfind(str, sub, start = 1, end = nchar(str))

Arguments

str
A character vector.
sub
A character vector.
start
A numeric vector.
end
A numeric vector.

Value

A numeric vector. -1 indicates sub was not found.

References

https://docs.python.org/3/library/stdtypes.html#str.rfind

See Also

pystr_find

Examples

Run this code
pystr_rfind("abcdxyzabc", "abc")
pystr_rfind("abc", "xy")
pystr_rfind("abcxyzabc", "abc", 4)

Run the code above in your browser using DataLab