Learn R Programming

pystr (version 2.0.0)

pystr_endswith: Check the suffix of a string.

Description

Return TRUE if the string str ends with the specified suffix, otherwise return FALSE.

Usage

pystr_endswith(str, suffix, start = 1, end = nchar(str))

Arguments

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

Value

A logical vector.

Details

With optional start, test beginning at that position. With optional end, stop comparing at that position.

References

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

See Also

pystr_startswith

Examples

Run this code
pystr_endswith("selfie.jpg", ".jpg")
pystr_endswith("selfie.jpg", ".png")
pystr_endswith("hello world", "ello", 1, 5)

Run the code above in your browser using DataLab