Skip to content

cstrcat

strings · scripts/strings/cstrcat.m

: str = cstrcat (s1, s2, …)

Join character arrays side by side without touching their blanks.

Unlike strcat, which strips trailing spaces from character arguments, cstrcat keeps every character of every argument. Arguments with several rows are joined row by row and must all have the same number of rows.

cstrcat ("left   ", "right")
      ⇒  "left   right"

s = ["x  "; "yyy"];
cstrcat (s, "-", s)
      ⇒  "x  -x  "
         "yyy-yyy"