strs_endswith: Check if string ends with a specified suffix

View source: R/endswith.R

strs_endswithR Documentation

Check if string ends with a specified suffix

Description

strs_endswith determines whether each element of a character vector ends with a specified suffix. This function is similar to Python's str.endswith() method.

Usage

strs_endswith(string, suffix)

Arguments

string

A character vector where each element is a string to be checked.

suffix

The suffix to check for at the end of each element of string.

Value

A logical vector of the same length as string, with each element indicating whether the corresponding element of string ends with suffix.

See Also

Python str.endswith() documentation

Examples

strs_endswith("hello world", "world")
strs_endswith(c("test", "hello", "world"), "ld")

strs documentation built on Sept. 11, 2024, 6:44 p.m.