Given a character vector, each element is split, the first
nchars
characters are extracted from each part and all parts are
concatenated with sep
.
This is useful to obtain shortcuts of lengthy strings.
str_to_shortcut(x, split, nchars = 1, sep = "-", ...)
x | [ |
---|---|
split | [ |
nchars | [ |
sep | [ |
... | [ |
Shortcut version of x
.
Other string helpers:
str_explode()
,
str_parse()
#> [1] "h-w" "s-l-s"str_to_shortcut(x, nchars = 2L, sep = "", split = "-")#> [1] "hewo" "solest"