EVOLUTION-MANAGER
Edit File: ansi_nchar.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Count number of characters in an ANSI colored string</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for ansi_nchar {cli}"><tr><td>ansi_nchar {cli}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Count number of characters in an ANSI colored string</h2> <h3>Description</h3> <p>This is a color-aware counterpart of <code><a href="utf8_nchar.html">utf8_nchar()</a></code>. By default it counts Unicode grapheme clusters, instead of code points. </p> <h3>Usage</h3> <pre> ansi_nchar(x, type = c("chars", "bytes", "width", "graphemes", "codepoints")) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>Character vector, potentially ANSI styled, or a vector to be coerced to character. If it converted to UTF-8.</p> </td></tr> <tr valign="top"><td><code>type</code></td> <td> <p>Whether to count graphemes (characters), code points, bytes, or calculate the display width of the string.</p> </td></tr> </table> <h3>Value</h3> <p>Numeric vector, the length of the strings in the character vector. </p> <h3>See Also</h3> <p>Other ANSI string operations: <code><a href="ansi_align.html">ansi_align</a>()</code>, <code><a href="ansi_columns.html">ansi_columns</a>()</code>, <code><a href="ansi_strsplit.html">ansi_strsplit</a>()</code>, <code><a href="ansi_strtrim.html">ansi_strtrim</a>()</code>, <code><a href="ansi_strwrap.html">ansi_strwrap</a>()</code>, <code><a href="ansi_substring.html">ansi_substring</a>()</code>, <code><a href="ansi_substr.html">ansi_substr</a>()</code>, <code><a href="ansi_toupper.html">ansi_toupper</a>()</code>, <code><a href="ansi_trimws.html">ansi_trimws</a>()</code> </p> <h3>Examples</h3> <pre> str <- paste( col_red("red"), "default", col_green("green") ) cat(str, "\n") nchar(str) ansi_nchar(str) nchar(ansi_strip(str)) </pre> <hr /><div style="text-align: center;">[Package <em>cli</em> version 3.4.1 <a href="00Index.html">Index</a>]</div> </body></html>