If words
is of length 2, the first word and second word are joined by the
and
string; if and
is blank, sep
is used. When the length is greater
than 2, sep
is used to separate all words, and the and
string is
prepended to the last word.
join_words(
words,
sep = ", ",
and = " and ",
before = "",
after = before,
oxford_comma = TRUE
)
A character string marked by raw_string()
.
join_words("a")
#> a
join_words(c("a", "b"))
#> a and b
join_words(c("a", "b", "c"))
#> a, b, and c
join_words(c("a", "b", "c"), sep = " / ", and = "")
#> a / b / c
join_words(c("a", "b", "c"), and = "")
#> a, b, c
join_words(c("a", "b", "c"), before = "\"", after = "\"")
#> "a", "b", and "c"
join_words(c("a", "b", "c"), before = "\"", after = "\"", oxford_comma = FALSE)
#> "a", "b" and "c"