ansi_strwrap: Wrap Character Strings to Format Paragraphs - ANSI Aware

Description Usage Arguments Whitespace

View source: R/strwrap.R

Description

This is an ANSI-aware copy of base::strwrap.

Usage

1
2
ansi_strwrap(x, width = 0.9 * getOption("width"), indent = 0, exdent = 0,
  prefix = "", simplify = TRUE, initial = prefix)

Arguments

x:

a character vector, or an object which can be converted to a character vector by ‘as.character’.

width:

a positive integer giving the target column for wrapping lines in the output.

indent:

a non-negative integer giving the indentation of the first line in a paragraph.

exdent:

a non-negative integer specifying the indentation of subsequent lines in paragraphs.

prefix:

a character string to be used as prefix for each line except the first, for which ‘initial’ is used.

initial:

a character string to be used as prefix for the first line

simplify:

a logical. If ‘TRUE’, the result is a single character vector of line text; otherwise, it is a list of the same length as x the elements of which are character vectors of line text obtained from the corresponding element of x. (Hence, the result in the former case is obtained by unlisting that of the latter.)

Whitespace

Tabs, new lines, and form feeds are treated as single spaces, space sequences are treated as single spaces except that those following end of sentence markers (i.e. ‘.’, ‘?’, or ‘!’ will be treated as two spaces if they are two spaces or longer. All other whitespace, including but not limited to vertical tabs, carriage returns, etc., are treated as if they occupy one screen character.


r-lib/ansistrings documentation built on March 7, 2020, 10:13 p.m.