strcat
concatenates character strings
Syntax
txt = strcat(strings) txt = strcat(strings, string_added) txt = strcat(strings, string_added, "r") txt = strcat(strings, string_added, "c")
Arguments
- strings
vector, matrix, or hypermatrix of strings.
- string_added
a string added, default value is the zero length character string
"".- txt
a string.
- "r" | "c" flag
"r"glues together all rows of each column, in the arraystrings. Ifstringsis a matrix,txtis a row of longer strings."c"glues all columns of each row.
Description
txt = strcat(strings) concatenates character strings:
txt = strings(1) + ... + strings(n).
txt = strcat(strings, string_added) returns
txt = strings(1) + string_added + ... + string_added + strings(n).
The plus symbol does the same: "a"+"b" is the
same as strcat(["a","b"])..
If the size of strings is one, it returns
txt = strings(1);
strcat('A','B') returns 'A' and not
'AB' as strcat(['A','B']).
If strings is a matrix of strings,
txt = strcat(strings, "", "r") returns a row vector of strings.
Each entry of txt results from the concatenation of rows along
the related column.
txt = strcat(strings, "", "c") returns a column vector of strings.
Each entry of txt results from the concatenation of columns along
the related row.
Examples
strcat(string(1:10),',') strcat(["a","b"]) strcat(["a","b"],'|') strcat('A') strcat('A','B') strcat(['A','B']) strcat(['A','B'],'') m =["a" "b" ; "c" "d"]; strcat(m, "r") strcat(m, "", "r") strcat(m, "", "c") strcat(m, "_and_", "r") strcat(m, "_and_", "c")
See also
- string — conversion to character string
- strings — Character strings
- strsplit — split a single string at some given positions or patterns
- brackets [] — Concatenation. Recipients of an assignment. Results of a function
| Report an issue | ||
| << sci2exp | Strings | strchr >> |