str_detect {stringr} | R Documentation |
Vectorised over string
and pattern
.
str_detect(string, pattern)
string |
input vector. This must be an atomic vector, and will be coerced to a character vector |
pattern |
pattern to look for, as defined by a POSIX
regular expression. See the “Extended Regular
Expressions” section of |
boolean vector
grepl
which this function wraps
fruit <- c("apple", "banana", "pear", "pinapple") str_detect(fruit, "a") str_detect(fruit, "^a") str_detect(fruit, "a$") str_detect(fruit, "b") str_detect(fruit, "[aeiou]") # Also vectorised over pattern str_detect("aecfg", letters)