1 ## Copyright (C) 1994-2012 John W. Eaton
3 ## This file is part of Octave.
5 ## Octave is free software; you can redistribute it and/or modify it
6 ## under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation; either version 3 of the License, or (at
8 ## your option) any later version.
10 ## Octave is distributed in the hope that it will be useful, but
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 ## General Public License for more details.
15 ## You should have received a copy of the GNU General Public License
16 ## along with Octave; see the file COPYING. If not, see
17 ## <http://www.gnu.org/licenses/>.
20 ## @deftypefn {Function File} {} cstrcat (@var{s1}, @var{s2}, @dots{})
21 ## Return a string containing all the arguments concatenated
22 ## horizontally. Trailing white space is preserved. For example:
26 ## cstrcat ("ab ", "cd")
33 ## s = [ "ab"; "cde" ];
35 ## @result{} "ab ab ab "
39 ## @seealso{strcat, char, strvcat}
44 function st = cstrcat (varargin)
48 elseif (! iscellstr (varargin))
49 error ("cstrcat: expecting arguments to character strings");
57 ## Test the dimensionality
59 %!assert (cstrcat ("ab ", "ab "), "ab ab ")
61 %!assert (cstrcat (["ab ";"cde"], ["ab ";"cde"]), ["ab ab ";"cdecde"])
63 %!assert (cstrcat ("foo", "bar"), "foobar")
64 %!assert (cstrcat (["a"; "bb"], ["foo"; "bar"]), ["a foo"; "bbbar"])
66 %% Test input validation
68 %!error cstrcat (1, 2);