EVOLUTION-MANAGER
Edit File: ansi_strwrap.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: Wrap an ANSI styled string to a certain width</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_strwrap {cli}"><tr><td>ansi_strwrap {cli}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Wrap an ANSI styled string to a certain width</h2> <h3>Description</h3> <p>This function is similar to <code><a href="../../base/html/strwrap.html">base::strwrap()</a></code>, but works on ANSI styled strings, and leaves the styling intact. </p> <h3>Usage</h3> <pre> ansi_strwrap( x, width = console_width(), indent = 0, exdent = 0, simplify = TRUE ) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>ANSI string.</p> </td></tr> <tr valign="top"><td><code>width</code></td> <td> <p>Width to wrap to.</p> </td></tr> <tr valign="top"><td><code>indent</code></td> <td> <p>Indentation of the first line of each paragraph.</p> </td></tr> <tr valign="top"><td><code>exdent</code></td> <td> <p>Indentation of the subsequent lines of each paragraph.</p> </td></tr> <tr valign="top"><td><code>simplify</code></td> <td> <p>Whether to return all wrapped strings in a single character vector, or wrap each element of <code>x</code> independently and return a list.</p> </td></tr> </table> <h3>Value</h3> <p>If <code>simplify</code> is <code>FALSE</code>, then a list of character vectors, each an ANSI string. Otherwise a single ANSI string 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_nchar.html">ansi_nchar</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_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> text <- cli:::lorem_ipsum() # Highlight some words, that start with 's' rexp <- gregexpr("\\b([sS][a-zA-Z]+)\\b", text) regmatches(text, rexp) <- lapply(regmatches(text, rexp), col_red) cat(text) wrp <- ansi_strwrap(text, width = 40) cat(wrp, sep = "\n") </pre> <hr /><div style="text-align: center;">[Package <em>cli</em> version 3.4.1 <a href="00Index.html">Index</a>]</div> </body></html>