Mercurial > hg > octave-lyh
diff src/strfns.cc @ 1355:94697d007075
[project @ 1995-09-05 20:04:15 by jwe]
author | jwe |
---|---|
date | Tue, 05 Sep 1995 20:07:21 +0000 |
parents | 611d403c7f3d |
children | dc9c01f66a19 |
line wrap: on
line diff
--- a/src/strfns.cc +++ b/src/strfns.cc @@ -25,18 +25,17 @@ #include <config.h> #endif -#include <ctype.h> -#include <string.h> +#include <cctype> #include "dMatrix.h" -#include "tree-const.h" -#include "oct-obj.h" +#include "defun.h" #include "error.h" #include "gripes.h" -#include "defun.h" +#include "help.h" +#include "oct-obj.h" +#include "tree-const.h" #include "utils.h" -#include "help.h" DEFUN ("isstr", Fisstr, Sisstr, 1, 1, "isstr (X): return 1 if X is a string, 0 otherwise") @@ -81,14 +80,21 @@ if (arg.is_string ()) { - char *str = args(0).string_value (); + Octave_str_obj str = args(0).all_strings (); - int len = strlen (str); + int nr = str.num_strings (); + int nc = str.max_length (); + +// XXX FIXME XXX -- should fill with user-specified value. - Matrix m (1, len); + Matrix m (nr, nc, 0); - for (int i = 0; i < len; i++) - m (0, i) = toascii (str[i]); + for (int i = 0; i < nr; i++) + { + nc = str.elem (i).length (); + for (int j = 0; j < nc; j++) + m (i, j) = toascii (str.elem (i) [j]); + } retval = m; }