807
|
1 /* |
|
2 |
2847
|
3 Copyright (C) 1996, 1997 John W. Eaton |
807
|
4 |
|
5 This file is part of Octave. |
|
6 |
|
7 Octave is free software; you can redistribute it and/or modify it |
|
8 under the terms of the GNU General Public License as published by the |
|
9 Free Software Foundation; either version 2, or (at your option) any |
|
10 later version. |
|
11 |
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
15 for more details. |
|
16 |
|
17 You should have received a copy of the GNU General Public License |
|
18 along with Octave; see the file COPYING. If not, write to the Free |
1315
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
807
|
20 |
|
21 */ |
|
22 |
|
23 #ifdef HAVE_CONFIG_H |
1192
|
24 #include <config.h> |
807
|
25 #endif |
|
26 |
1355
|
27 #include <cctype> |
807
|
28 |
|
29 #include "dMatrix.h" |
|
30 |
1355
|
31 #include "defun.h" |
807
|
32 #include "error.h" |
|
33 #include "gripes.h" |
2366
|
34 #include "ov.h" |
1355
|
35 #include "oct-obj.h" |
807
|
36 #include "utils.h" |
|
37 |
1957
|
38 DEFUN (isstr, args, , |
3361
|
39 "-*- texinfo -*-\n\ |
|
40 @deftypefn {Built-in Function} {} isstr (@var{a})\n\ |
|
41 Return 1 if @var{a} is a string. Otherwise, return 0.\n\ |
|
42 @end deftypefn") |
807
|
43 { |
2086
|
44 octave_value_list retval; |
807
|
45 |
|
46 int nargin = args.length (); |
|
47 |
|
48 if (nargin == 1 && args(0).is_defined ()) |
2800
|
49 retval = static_cast<double> (args(0).is_string ()); |
807
|
50 else |
|
51 print_usage ("isstr"); |
|
52 |
|
53 return retval; |
|
54 } |
|
55 |
1957
|
56 DEFUN (setstr, args, , |
3361
|
57 "-*- texinfo -*-\n\ |
|
58 @deftypefn {Built-in Function} {} setstr (@var{x})\n\ |
|
59 Convert a matrix to a string. Each element of the matrix is converted\n\ |
|
60 to the corresponding ASCII \n\ |
|
61 character. For example,\n\ |
|
62 \n\ |
|
63 @example\n\ |
|
64 @group\n\ |
|
65 setstr ([97, 98, 99])\n\ |
|
66 @result{} "abc"\n\ |
|
67 @end group\n\ |
|
68 @end example\n\ |
|
69 @end deftypefn") |
807
|
70 { |
2086
|
71 octave_value_list retval; |
807
|
72 |
|
73 int nargin = args.length (); |
|
74 |
|
75 if (nargin == 1 && args(0).is_defined ()) |
|
76 retval = args(0).convert_to_str (); |
|
77 else |
|
78 print_usage ("setstr"); |
|
79 |
|
80 return retval; |
|
81 } |
|
82 |
|
83 /* |
|
84 ;;; Local Variables: *** |
|
85 ;;; mode: C++ *** |
|
86 ;;; End: *** |
|
87 */ |