stringi
stringi copied to clipboard
stri_sub_index()
stri_subindex("abcde", 1:2) == "ab"
stri_subindex("abcde", c(1,3,5)) == "ace"
stri_subindex("abcde", c(5,5,2)) == "eeb"
stri_subindex("abcde", c(-1,-5)), == "bcd"
also should work for logical vectors
stri_subindex("abcde", c(T,F,T,F,T) == "acd"
single vector -> vectorized w.r.t. number of characters
a list of integer or logical vectors can also be given
This can be imitated with #30, arg. length == 1
> stri_join_list(stri_sub_all("spam", c(4, 3, 2, 3, 1), length=1))
[1] "mapas"
> stri_join_list(stri_sub_all("spam", list(c(4, 3, 2, 3, 1), c(1, -1)), length=1))
[1] "mapas" "sm"