From bug-octave-request at bevo dot che dot wisc dot edu Fri Nov 6 12:20:17 1998 Subject: octave-2.1.8 bug: empty string bug From: "John W. Eaton" To: Joao Cardoso Cc: bug-octave Date: Fri, 6 Nov 1998 12:19:08 -0600 (CST) On 6-Nov-1998, Joao Cardoso wrote: | octave-2.1.8:1> a="" | a = | octave-2.1.8:2> isempty (a) | ans = 0 | | isempty (x): return nonzero if x is an empty matrix or empty list | | this does not apply to strings? It should. Please try the following patch. Thanks, jwe Fri Nov 6 12:14:29 1998 John W. Eaton * data.cc (Fisempty): Also return true for empty strings. Index: data.cc =================================================================== RCS file: /home/jwe/src/master/octave/src/data.cc,v retrieving revision 1.61 diff -c -r1.61 data.cc *** data.cc 1998/11/05 04:24:45 1.61 --- data.cc 1998/11/06 18:14:27 *************** *** 782,788 **** } DEFUN (isempty, args, , ! "isempty (x): return nonzero if x is an empty matrix or empty list") { double retval = 0.0; --- 782,788 ---- } DEFUN (isempty, args, , ! "isempty (x): return nonzero if x is an empty matrix, string, or list") { double retval = 0.0; *************** *** 792,798 **** if (arg.is_matrix_type ()) retval = static_cast (arg.rows () == 0 || arg.columns () == 0); ! else if (arg.is_list ()) retval = static_cast (arg.length () == 0); } else --- 792,798 ---- if (arg.is_matrix_type ()) retval = static_cast (arg.rows () == 0 || arg.columns () == 0); ! else if (arg.is_list () || arg.is_string ()) retval = static_cast (arg.length () == 0); } else