1% Generated by roxygen2: do not edit by hand
2% Please edit documentation in R/string_operations.r
3\name{col_nchar}
4\alias{col_nchar}
5\title{Count number of characters in an ANSI colored string}
6\usage{
7col_nchar(x, ...)
8}
9\arguments{
10\item{x}{Character vector, potentially ANSO styled, or a vector to be
11coarced to character.}
12
13\item{...}{Additional arguments, passed on to \code{base::nchar()}
14after removing ANSI escape sequences.}
15}
16\value{
17Numeric vector, the length of the strings in the character
18vector.
19}
20\description{
21This is a color-aware counterpart of \code{\link[base:nchar]{base::nchar()}},
22which does not do well, since it also counts the ANSI control
23characters.
24}
25\examples{
26str <- paste(
27  red("red"),
28  "default",
29  green("green")
30)
31
32cat(str, "\n")
33nchar(str)
34col_nchar(str)
35nchar(strip_style(str))
36}
37\seealso{
38Other ANSI string operations:
39\code{\link{col_align}()},
40\code{\link{col_strsplit}()},
41\code{\link{col_substring}()},
42\code{\link{col_substr}()}
43}
44\concept{ANSI string operations}
45