substring
is compatible with S, with first
and
last
instead of start
and stop
.
For vector arguments, it expands the arguments cyclically to the
length of the longest provided none are of zero length.
When extracting, if start
is larger than the string length then
""
is returned.
For the extraction functions, x
or text
will be
converted to a character vector by as.character
if it is not
already one.
For the replacement functions, if start
is larger than the
string length then no replacement is done. If the portion to be
replaced is longer than the replacement string, then only the
portion the length of the string is replaced.
If any argument is an NA
element, the corresponding element of
the answer is NA
.
Elements of the result will be have the encoding declared as that of
the current locale (see Encoding
if the corresponding
input had a declared Latin-1 or UTF-8 encoding and the current locale
is either Latin-1 or UTF-8.
If an input element has declared "bytes"
encoding (see
Encoding
, the subsetting is done in units of bytes not
characters.