strs_contains {strs} | R Documentation |
Check if string contains a substring
Description
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.
Usage
strs_contains(string, substring)
Arguments
string |
A character vector where each element is a string to be checked. |
substring |
The substring to search for within each element of |
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")
strs_contains(c("apple", "banana", "cherry"), "a")
[Package strs version 0.1.0 Index]