strjoin
Join strings in array
Description
Note
join
is recommended over
strjoin
because it provides greater flexibility and
allows vectorization. For more information, see Alternative Functionality.
str = strjoin(
constructs
C
)str
by linking the elements of C
with a
space between consecutive elements. C
can be a cell array of
character vectors or a string array.
Examples
Input Arguments
Alternative Functionality
Update code that makes use of strjoin
to use join
instead. strjoin
returns a character vector if
the input is a cell array of character vectors and returns a string scalar if the input
is a string array. join
returns a text scalar of the same type as the
input. For example:
Not Recommended | Direct Replacement | Match Original Behavior |
---|---|---|
C = {'one','two','three'}; str = strjoin(C) str = 'one two three' |
C = {'one','two','three'}; str = join(C) str = {'one two three'} |
C = {'one','two','three'}; str = char(join(C)) str = 'one two three' |
Extended Capabilities
Version History
Introduced in R2013a