ansi_toupper: ANSI character translation and case folding

Description Usage Arguments Value See Also Examples

View source: R/ansiex.R

Description

There functions are similar to toupper(), tolower() and chartr(), but they keep the ANSI colors of the string.

Usage

1
2
3
4
5

Arguments

x

Input string. May have ANSI colors and styles.

old

a character string specifying the characters to be translated. If a character vector of length 2 or more is supplied, the first element is used with a warning.

new

a character string specifying the translations. If a character vector of length 2 or more is supplied, the first element is used with a warning.

Value

Character vector of the same length as x, containing the translated strings. ANSI styles are retained.

See Also

Other ANSI string operations: ansi_align(), ansi_columns(), ansi_nchar(), ansi_strsplit(), ansi_strtrim(), ansi_strwrap(), ansi_substring(), ansi_substr(), ansi_trimws()

Other ANSI string operations: ansi_align(), ansi_columns(), ansi_nchar(), ansi_strsplit(), ansi_strtrim(), ansi_strwrap(), ansi_substring(), ansi_substr(), ansi_trimws()

Other ANSI string operations: ansi_align(), ansi_columns(), ansi_nchar(), ansi_strsplit(), ansi_strtrim(), ansi_strwrap(), ansi_substring(), ansi_substr(), ansi_trimws()

Examples

1
2
3
4
5
6
ansi_toupper(col_red("Uppercase"))

ansi_tolower(col_red("LowerCase"))

x <- paste0(col_green("MiXeD"), col_red(" cAsE 123"))
ansi_chartr("iXs", "why", x)

RonMobile/cli documentation built on Dec. 18, 2021, 11 a.m.