Learn R Programming

pystr (version 2.0.0)

pystr_find: Find the lowest index of a substring.

Description

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

Usage

pystr_find(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.find

See Also

pystr_rfind

Examples

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

Run the code above in your browser using DataLab