stringi icon indicating copy to clipboard operation
stringi copied to clipboard

str_sub_boundaries ?

Open hadley opened this issue 9 years ago • 3 comments

Seems like it would make sense to have a version of str_sub() that let you specify how the string was decomposed into subunits.

hadley avatar Nov 27 '14 15:11 hadley

I don't get it (?) Could you provide an illustration for that?

gagolews avatar Nov 27 '14 21:11 gagolews

I was thinking something like:

words <- "one two three"
stri_sub(words, 1, 2, stri_opt_brkiter("word", skip_word_none = TRUE))
# "one two"
stri_sub(words, 3, 3, stri_opt_brkiter("word", skip_word_none = TRUE)) <- "3"
words
# "one two 3"

i.e. there's some natural equivalence between stri_locate_boundaries() and stri_sub().

hadley avatar Nov 27 '14 22:11 hadley

[INTERNAL] This is somehow linked with #127 (stri_sub<- -> stri_replace, stri_sub -> stri_extract)

gagolews avatar Dec 05 '14 22:12 gagolews