str_after_nth(strings, pattern, n)str_after_first(strings, pattern)
str_after_last(strings, pattern)
str_before_nth(strings, pattern, n)
str_before_first(strings, pattern)
str_before_last(strings, pattern)
A character vector.
A character vector. Pattern(s) specified like the pattern(s)
in the stringr package (e.g. look at stringr::str_locate()
). If
this has length >1 its length must be the same as that of string
.
A natural number to identify the \(n\)th occurrence (defaults to
first (n = 1
)). This can be negatively indexed, so if you wish to select
the last occurrence, you need n = -1
, for the second-last, you
need n = -2
and so on.