Count number of characters in an ANSI colored string
This is a color-aware counterpart of
which does not do well, since it also counts the ANSI control
- Character vector, potentially ANSO styled, or a vector to be coarced to character.
- Additional arguments, passed on to
base::ncharafter removing ANSI escape sequences.
Numeric vector, the length of the strings in the character
str <- paste( red("red"), "default", green("green") ) cat(str, "\n") nchar(str) col_nchar(str) nchar(strip_style(str))
Looks like there are no examples yet.