Code
ansi_substr("foobar", NULL, 10)
Condition
Error:
! `ansi_substr()` must have non-empty `start` and `stop` arguments
i `start` has length 0
Code
ansi_substr("foobar", 10, NULL)
Condition
Error:
! `ansi_substr()` must have non-empty `start` and `stop` arguments
i `stop` has length 0
Code
ansi_substr("foobar", "bad", "bad")
Condition
Error:
! `start` and `stop` must not have `NA` values
i `start` has 1 `NA` value, after coercion to integer
i `stop` has 1 `NA` value, after coercion to integer
Code
ansi_substr("abc", "hello", 1)
Condition
[1m[33mError[39m:[22m
[33m![39m [1m[22m`start` and `stop` must not have `NA` values
[36mi[39m `start` has 1 `NA` value, after coercion to integer
Code
ansi_strsplit(c("ab", "bd"), c("b", "d"))
Condition
[1m[33mError[39m:[22m
[33m![39m [1m[22m`split` must be character of length <= 1, or must coerce to that
[36mi[39m `split` is (or was coerced to) a character vector
Code
ansi_strtrim("12345", 1, ellipsis = "")
Output
<cli_ansi_string>
[1] 1
Code
ansi_strtrim("12345", 3, ellipsis = "")
Output
<cli_ansi_string>
[1] 123
Code
ansi_strtrim("12345", 5, ellipsis = "")
Output
<cli_ansi_string>
[1] 12345
Code
ansi_strtrim("foobar", -1)
Condition
Error:
! `width` must be non-negative in `cli::ansi_strtrim()`.
Code
ansi_strtrim("foobar", width = 3, ellipsis = "...")
Output
[1] "..."
Code
ansi_strtrim("foobar", width = 2, ellipsis = "...")
Output
[1] ".."
Code
ansi_strtrim("foobar", width = 1, ellipsis = "...")
Output
[1] "."
Code
ansi_strtrim("foobar", width = 0, ellipsis = "...")
Output
[1] ""
foo 1 foo 2 foo 3 foo 4
foo 5 foo 6 foo 7 foo 8
foo 9 foo 10
123456789012...
Code
local({
cat_line(x)
cat_line(ansi_toupper(x))
})
Output
Red normal green
RED NORMAL GREEN
Code
local({
cat_line(x)
cat_line(ansi_toupper(x))
})
Output
[31mRed [39mnormal [1m[32mgreen[39m[22m
[31mRED [39mNORMAL [1m[32mGREEN[39m[22m
Code
local({
cat_line(x)
cat_line(ansi_tolower(x))
})
Output
Red NORMAL grEeN
red normal green
Code
local({
cat_line(x)
cat_line(ansi_tolower(x))
})
Output
[31mRed [39mNORMAL [1m[32mgrEeN[39m[22m
[31mred [39mnormal [1m[32mgreen[39m[22m
Code
local({
cat_line(x)
cat_line(ansi_chartr(" R_", "-r*", x))
})
Output
Red normal green
red-normal-green
Code
local({
cat_line(x)
cat_line(ansi_chartr(" R_", "-r*", x))
})
Output
[31mRed [39mnormal [1m[32mgreen[39m[22m
[31mred-[39mnormal-[1m[32mgreen[39m[22m
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.