stri_flatten: Flatten a String

Description Usage Arguments Details Value See Also Examples

Description

Joins the elements of a character vector into one string.

Usage

1
stri_flatten(str, collapse = "")

Arguments

str

vector of strings to be coerced to character

collapse

single string denoting the separator

Details

stri_flatten(str, collapse='XXX') works like paste(str, collapse='XXX', sep="").

If you wish to use some more fancy collapse 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_c, stri_join, stri_paste; stri_dup

Examples

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

Example output

[1] "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
[1] "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z"
[1] "abc123<U+0105><U+0104>"
[1] "abbcccdeefff"

stringi documentation built on May 2, 2019, 4:54 p.m.