Description Usage Arguments Value The DecoratedString S3 class Examples
View source: R/decorate-string.R
Decorate a character string by adding a prefix and/or suffix to it, and by setting ANSI standardized SGR (Select Graphic Rendition) parameters for it. These parameters are always scoped to the decorated string.
1 2 3 4 5 6 7 8 9 10 |
string |
A character string to be decorated. It cannot be empty. |
prefix |
An optional character string to append to the beginning of |
suffix |
An optional character string to append to the end of |
sgrSet |
An optional set of ANSI SGR parameters that adds one or more styles to
|
sgrReset |
An optional set of ANSI SGR parameters that resets all styles previously
set by SGR parameters passed to The length of |
x |
A DecoratedString object to print. |
... |
Currently ignored. |
A character(1)
of S3 class DecoratedString.
This class does very little. It has
a single print()
method that conveys the object's internal value and
its appearance when printed in a terminal.
1 2 3 4 5 6 7 8 | ## Create HTML tags.
decorateString("Here is some text.", "<p>", "</p>")
## Add ANSI styles, here bold text (SGR parameters 1 and 22).
decorateString("Here is some bold text.", sgrSet = 1L, sgrReset = 22L)
## All at once.
decorateString("Here is some bold text.", "<b>", "</b>", 1L, 22L)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.