strs_startswith
determines whether each element of a character vector
starts with a specified prefix. It is similar to Python's str.startswith()
method.
Value
A logical vector of the same length as string
, with each element
indicating whether the corresponding element of string
starts with
prefix
.
Examples
strs_startswith("hello world", "hello")
#> [1] TRUE
strs_startswith(c("test", "hello", "world"), "te")
#> [1] TRUE FALSE FALSE