Wrap strings with flanking characters

wrap(x, left, right = left)

dbl_quote(..., sep = "")

sngl_quote(..., sep = "")

bracket(..., sep = "")

brace(..., sep = "")

parens(..., sep = "")

Arguments

x

character to wrap

left, right

character pair to wrap with

sep, ...

passed to base::paste before wrapping

See also

Examples

wrap("abc", "__") # __abc__
#> [1] "__abc__"
parens("abc") # (abc)
#> [1] "(abc)"
sngl_quote("abc") # 'abc'
#> [1] "'abc'"
dbl_quote("abc") # "abc"
#> [1] "\"abc\""
bracket("abc") # [abc]
#> [1] "[abc]"
brace("abc") # {abc}
#> [1] "{abc}"
label <- p("name", parens("attribute")) label # "name (attribute)"
#> [1] "name(attribute)"
unparens(label) # "name attribute"
#> [1] "nameattribute"
# make your own function like this: # markdown bold bold <- function(...) wrap(paste(...), "**") p("make a word", bold("bold"))
#> [1] "make a word**bold**"
# see unbold example in ?unwrap