annotate scripts/strings/strcat.m @ 920:1677bb6533fb

[project @ 1994-11-14 16:37:05 by jwe] Initial revision
author jwe
date Mon, 14 Nov 1994 16:37:05 +0000
parents
children 3f257ab07921
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
920
1677bb6533fb [project @ 1994-11-14 16:37:05 by jwe]
jwe
parents:
diff changeset
1 # Copyright (C) 1994 John W. Eaton
1677bb6533fb [project @ 1994-11-14 16:37:05 by jwe]
jwe
parents:
diff changeset
2 #
1677bb6533fb [project @ 1994-11-14 16:37:05 by jwe]
jwe
parents:
diff changeset
3 # This file is part of Octave.
1677bb6533fb [project @ 1994-11-14 16:37:05 by jwe]
jwe
parents:
diff changeset
4 #
1677bb6533fb [project @ 1994-11-14 16:37:05 by jwe]
jwe
parents:
diff changeset
5 # Octave is free software; you can redistribute it and/or modify it
1677bb6533fb [project @ 1994-11-14 16:37:05 by jwe]
jwe
parents:
diff changeset
6 # under the terms of the GNU General Public License as published by the
1677bb6533fb [project @ 1994-11-14 16:37:05 by jwe]
jwe
parents:
diff changeset
7 # Free Software Foundation; either version 2, or (at your option) any
1677bb6533fb [project @ 1994-11-14 16:37:05 by jwe]
jwe
parents:
diff changeset
8 # later version.
1677bb6533fb [project @ 1994-11-14 16:37:05 by jwe]
jwe
parents:
diff changeset
9 #
1677bb6533fb [project @ 1994-11-14 16:37:05 by jwe]
jwe
parents:
diff changeset
10 # Octave is distributed in the hope that it will be useful, but WITHOUT
1677bb6533fb [project @ 1994-11-14 16:37:05 by jwe]
jwe
parents:
diff changeset
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1677bb6533fb [project @ 1994-11-14 16:37:05 by jwe]
jwe
parents:
diff changeset
12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1677bb6533fb [project @ 1994-11-14 16:37:05 by jwe]
jwe
parents:
diff changeset
13 # for more details.
1677bb6533fb [project @ 1994-11-14 16:37:05 by jwe]
jwe
parents:
diff changeset
14 #
1677bb6533fb [project @ 1994-11-14 16:37:05 by jwe]
jwe
parents:
diff changeset
15 # You should have received a copy of the GNU General Public License
1677bb6533fb [project @ 1994-11-14 16:37:05 by jwe]
jwe
parents:
diff changeset
16 # along with Octave; see the file COPYING. If not, write to the Free
1677bb6533fb [project @ 1994-11-14 16:37:05 by jwe]
jwe
parents:
diff changeset
17 # Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
1677bb6533fb [project @ 1994-11-14 16:37:05 by jwe]
jwe
parents:
diff changeset
18
1677bb6533fb [project @ 1994-11-14 16:37:05 by jwe]
jwe
parents:
diff changeset
19 function st = strcat (s, t, ...)
1677bb6533fb [project @ 1994-11-14 16:37:05 by jwe]
jwe
parents:
diff changeset
20
1677bb6533fb [project @ 1994-11-14 16:37:05 by jwe]
jwe
parents:
diff changeset
21 if (nargin > 1)
1677bb6533fb [project @ 1994-11-14 16:37:05 by jwe]
jwe
parents:
diff changeset
22 if (isstr (s) && isstr (t))
1677bb6533fb [project @ 1994-11-14 16:37:05 by jwe]
jwe
parents:
diff changeset
23 tmpst = [s, t];
1677bb6533fb [project @ 1994-11-14 16:37:05 by jwe]
jwe
parents:
diff changeset
24 else
1677bb6533fb [project @ 1994-11-14 16:37:05 by jwe]
jwe
parents:
diff changeset
25 error ("strcat: all arguments must be strings");
1677bb6533fb [project @ 1994-11-14 16:37:05 by jwe]
jwe
parents:
diff changeset
26 endif
1677bb6533fb [project @ 1994-11-14 16:37:05 by jwe]
jwe
parents:
diff changeset
27 n = nargin - 2;
1677bb6533fb [project @ 1994-11-14 16:37:05 by jwe]
jwe
parents:
diff changeset
28 while (n--)
1677bb6533fb [project @ 1994-11-14 16:37:05 by jwe]
jwe
parents:
diff changeset
29 tmp = va_arg ();
1677bb6533fb [project @ 1994-11-14 16:37:05 by jwe]
jwe
parents:
diff changeset
30 if (isstr (tmp))
1677bb6533fb [project @ 1994-11-14 16:37:05 by jwe]
jwe
parents:
diff changeset
31 tmpst = [tmpst, tmp];
1677bb6533fb [project @ 1994-11-14 16:37:05 by jwe]
jwe
parents:
diff changeset
32 else
1677bb6533fb [project @ 1994-11-14 16:37:05 by jwe]
jwe
parents:
diff changeset
33 error ("strcat: all arguments must be strings");
1677bb6533fb [project @ 1994-11-14 16:37:05 by jwe]
jwe
parents:
diff changeset
34 endif
1677bb6533fb [project @ 1994-11-14 16:37:05 by jwe]
jwe
parents:
diff changeset
35 endwhile
1677bb6533fb [project @ 1994-11-14 16:37:05 by jwe]
jwe
parents:
diff changeset
36 else
1677bb6533fb [project @ 1994-11-14 16:37:05 by jwe]
jwe
parents:
diff changeset
37 usage ("strcat (s, t, ...)");
1677bb6533fb [project @ 1994-11-14 16:37:05 by jwe]
jwe
parents:
diff changeset
38 endif
1677bb6533fb [project @ 1994-11-14 16:37:05 by jwe]
jwe
parents:
diff changeset
39
1677bb6533fb [project @ 1994-11-14 16:37:05 by jwe]
jwe
parents:
diff changeset
40 st = tmpst;
1677bb6533fb [project @ 1994-11-14 16:37:05 by jwe]
jwe
parents:
diff changeset
41
1677bb6533fb [project @ 1994-11-14 16:37:05 by jwe]
jwe
parents:
diff changeset
42 endfunction