ansi_strip: Remove ANSI escape sequences from a string

View source: R/ansiex.R

ansi_stripR Documentation

Remove ANSI escape sequences from a string

Description

The input may be of class cli_ansi_string class, this is also dropped from the result.

Usage

ansi_strip(string, sgr = TRUE, csi = TRUE, link = TRUE)

Arguments

string

The input string.

sgr

Whether to remove for SGR (styling) control sequences.

csi

Whether to remove for non-SGR control sequences.

link

Whether to remove ANSI hyperlinks.

Value

The cleaned up string. Note that ansi_strip() always drops the cli_ansi_string class, even if sgr and sciareFALSE'.

See Also

Other low level ANSI functions: ansi_has_any(), ansi_hide_cursor(), ansi_regex(), ansi_string()

Examples

ansi_strip(col_red("foobar")) == "foobar"

cli documentation built on June 22, 2024, 10:57 a.m.