Skip to content

strcat

Concatenate strings horizontally.

t = strcat(s1, s2, ...)

Concatenates string inputs left to right. Trailing whitespace is stripped from each input before concatenation (matching MATLAB’s classic strcat behavior). For string concatenation that preserves trailing whitespace, use [s1 s2 ...] syntax or append.

strcat('hello', ' world') % 'helloworld' (trailing spaces stripped)
['hello' ' world'] % 'hello world' (preserves spaces)
  • append — Concatenate strings without trimming.
  • strvcat — Concatenate strings vertically (pad to equal length).
  • join — Join an array of strings into a single string.