strs_contains
checks whether each element of a character vector contains a
specified substring. This function mirrors the functionality of Python's
str.__contains__()
method.
Value
A logical vector of the same length as string
, with each element
indicating whether the corresponding element of string
contains
substring
.
Examples
strs_contains("hello world", "world")
#> [1] TRUE
strs_contains(c("apple", "banana", "cherry"), "a")
#> [1] TRUE TRUE FALSE