Vectorized over str
, [value
], from
and
(to
or length
). Just like in stri_sub
, parameters
to
and length
are mutually exclusive.
In one of the simplest scenarios, stri_sub_all(str, from, to)
,
the i-th element of the resulting list
generated like stri_sub(str[i], from[[i]], to[[i]])
.
As usual, if one of the inputs is shorter than the others,
recycling rule is applied.
If any of from
, to
, length
,
or value
is not a list,
it is wrapped into a list.
If from
consists of a two-column matrix, then these two columns are
used as from
and to
, respectively,
unless the second column is named length
.
Such types of index matrices are generated by
stri_locate_all
.
If extraction or replacement based on stri_locate_first
or stri_locate_last
is needed, see stri_sub
.
In the replacement function, the index ranges must be sorted
with respect to from
and must be mutually disjoint.
Negative length
does not result in any altering of the
corresponding input string. On the other hand, in stri_sub_all
,
this make the corresponding chunk be ignored,
see ignore_negative_length
, though.