Mercurial > hg > octave-lojdl
changeset 7813:12a68443191c
[mq]: cellstr
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Thu, 22 May 2008 22:00:26 +0200 |
parents | c25094267486 |
children | 87865ed7405f |
files | scripts/ChangeLog scripts/strings/strcat.m src/ChangeLog src/ov-cell.cc |
diffstat | 4 files changed, 14 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2008-06-02 Jaroslav Hajek <highegg@gmail.com> + + * strings/strcat.m: Add tests. + 2008-06-02 Kim Hansen <kimhanse@gmail.com> * strings/mat2str.m: Change is_complex to iscomplex, add tests, add
--- a/scripts/strings/strcat.m +++ b/scripts/strings/strcat.m @@ -94,6 +94,8 @@ %!assert(strcat({"ab "}, "ab "), {"ab ab"}) %!assert(strcat("ab ", {"ab "}), {"abab "}) %!assert(strcat({"ab "}, {"ab "}), {"ab ab "}) +%!assert(strcat("", "ab"), "ab") +%!assert(strcat("", {"ab"}, {""}), {"ab"}) ## 2d %!assert(strcat(["ab ";"cde"], ["ab ";"cde"]), ["abab ";"cdecde"])
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2008-06-02 Jaroslav Hajek <highegg@gmail.com> + + * ov-cell.cc (Fcellstr): For compatibility with Matlab, return {''} + when given ''. + 2008-05-21 David Bateman <dbateman@free.fr> * DLD-FUNCTIONS/quad.cc (quad_float_user_function): New function.
--- a/src/ov-cell.cc +++ b/src/ov-cell.cc @@ -1080,7 +1080,9 @@ string_vector s = args(0).all_strings (); if (! error_state) - retval = Cell (s, true); + retval = (s.is_empty () + ? Cell (octave_value (std::string ())) + : Cell (s, true)); else error ("cellstr: expecting argument to be a 2-d character array"); }