Skip to contents

str_concat() takes multiple string arguments and concatenates them into a single string, inserting a specified separator between each piece.

Usage

str_concat(..., separator = "")

Arguments

...

One or more character vectors or objects coercible to character vectors. These are the strings or objects to be concatenated.

separator

A character string to separate the concatenated elements. Defaults to an empty string, which results in no separation between elements.

Value

A single character string representing the concatenation of all input elements, separated by the specified separator.

See also

chr_collapse() for reduce a character vector into a single string.

paste(), which str_concat() wraps around.

Examples

str_concat("Hello", "world", separator = " ")
#> [1] "Hello world"
str_concat("2023", "01", "01", separator = "-")
#> [1] "2023-01-01"
str_concat("One", "Two", "Three")
#> [1] "OneTwoThree"