This is a color-aware counterpart of base::substr.
It works exactly like the original, but keeps the colors
in the substrings. The ANSI escape sequences are ignored when
calculating the positions within the string.
Usage
col_substr(x, start, stop)
Arguments
x
Character vector, potentially ANSI styled, or a vector to
coarced to character.
start
Starting index or indices, recycled to match the length
of x.
stop
Ending index or indices, recycled to match the length
of x.
Value
Character vector of the same length as x, containing
the requested substrings. ANSI styles are retained.
See Also
Other ANSI string operations: col_nchar;
col_strsplit; col_substring