yasp (version 0.1.0)

wrap: Wrap strings

Description

Wrap strings with flanking characters

Usage

wrap(x, left, right = left)

dbl_quote(...)

sngl_quote(...)

bracket(...)

brace(...)

parens(...)

Arguments

x

character to wrap

left, right

character pair to wrap with

...

passed to base::paste before wrapping

See Also

unwrap p0 sentence

Examples

Run this code
# NOT RUN {
wrap("abc", "__")  #  __abc__
parens("abc")      #   (abc)
sngl_quote("abc")  #   'abc'
dbl_quote("abc")   #   "abc"
bracket("abc")     #   [abc]
brace("abc")       #   {abc}

label <- p("name", parens("attribute"))

label             # "name (attribute)"
unparens(label)   # "name attribute"

# make your own function like this:
# markdown bold
bold <- function(...) wrap(paste(...), "**")
p("make a word", bold("bold"))
# see unbold example in ?unwrap
# }

Run the code above in your browser using DataLab