str_starts | R Documentation |
Vectorised over string
and pattern
, though using vectorised
patterns is relatively slow compared to stringr
.
str_starts(string, pattern, negate = FALSE) str_ends(string, pattern, negate = FALSE)
string |
|
pattern |
Can be:
|
negate |
|
Returns a logical vector
the same length as string
.
str_detect()
which this function wraps.
fruit <- c("apple", "banana", "pear", "pineapple") str_starts(fruit, "p") str_starts(fruit, "p", negate = TRUE) str_ends(fruit, "e") str_ends(fruit, "e", negate = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.