GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • cli
  • FAQ
  • Reference
  • Building a Semantic CLI
  • From usethis::ui functions to cli
  • cli pluralization
  • Introduction to progress bars in cli
  • Advanced cli progress bars
  • cli color palettes
  • More articles...
  • Changelog

This view

  • Original page
  • New address

GeezerVison is showing cli.r-lib.org — Remove ANSI escape sequences from a string — ansi_strip

Remove ANSI escape sequences from a string

Source: R/ansiex.R
ansi_strip.Rd

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"
#> [1] TRUE
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.