View source: R/string_operations.R
col_nchar | R Documentation |
This is a color-aware counterpart of base::nchar()
,
which does not do well, since it also counts the ANSI control
characters.
col_nchar(x, ...)
x |
Character vector, potentially ANSO styled, or a vector to be coarced to character. |
... |
Additional arguments, passed on to |
Numeric vector, the length of the strings in the character vector.
Other ANSI string operations:
col_align()
,
col_strsplit()
,
col_substr()
,
col_substring()
str <- paste(
red("red"),
"default",
green("green")
)
cat(str, "\n")
nchar(str)
col_nchar(str)
nchar(strip_style(str))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.