stri_flatten {stringi} | R Documentation

## Flatten a String

### Description

Joins the elements of a character vector into one string.

### Usage

    stri_flatten(str, collapse = "")

### Arguments

`str` | a vector of strings to be coerced to character
`collapse` | a single string denoting the separator

### Details

The `stri_flatten(str, collapse='XXX')` call is equivalent to `paste(str, collapse='XXX', sep="")`.

If you wish to use some more fancy (e.g. differing) separators between flattened strings, call `stri_join(str, separators, collapse='')`.

If `str` is not empty, then a single string is returned. If `collapse` has length > 1, then only first string will be used.

### Value

Returns a single string, i.e. a character vector of length 1.

### See Also

Other join: `stri_dup`, `stri_join_list`, `stri_join`

### Examples

    stri_flatten(LETTERS)
    stri_flatten(LETTERS, collapse=",")
    stri_flatten(c('abc', '123', '\u0105\u0104'))
    stri_flatten(stri_dup(letters[1:6],1:3))

[Package stringi version 1.1.5 Index]