Skip to contents

String convenience functions

Usage

str_vector(x, qchar = c("single", "double"))

str_bracket(x)

str_parenth(x)

str_double_quote(x)

str_quote(x)

Arguments

x

string item(s) to format

qchar

quote character to use. Either 'single' or "double"

Value

character

Examples

x <- "test"
cat(str_bracket(x), "\n")
#> [test] 
cat(str_parenth(x), "\n")
#> (test) 
cat(str_double_quote(x), "\n")
#> "test" 
cat(str_quote(x), "\n")
#> 'test' 

vec <- c("item1", "item2", "item3")
cat(str_vector(vec), "\n")
#> 'item1', 'item2', 'item3' 
cat(str_vector(vec, qchar = "double"))
#> "item1", "item2", "item3"