deblank and empty arguments

H. Wziontek hwz at hwz.bv.TU-Berlin.DE
Tue Jan 29 02:34:30 CST 2008


Hello,

I'd like to propose, that the function deblank should return
the argument itself instead of an error message if an empty
value is provided. Sometimes it can happen, that a value is
not defined, but for some reason, all values are "deblanked"
inside a loop. A script should not stop in such a case with
an error. Below my suggestion to change the code.

Hartmut


*** deblank.m.orig      Tue Jan 22 17:54:13 2008
--- deblank.m   Tue Jan 29 09:16:10 2008
*************** function s = deblank (s)
*** 34,39 ****
--- 34,41 ----
        print_usage ();
      endif

+   if (!isempty (s))
+
        if (ischar (s))

          k = find (! isspace (s) & s != "\0");
*************** function s = deblank (s)
*** 51,54 ****
--- 53,58 ----
          error ("deblank: expecting string argument");
        endif

+   endif
+
    endfunction


More information about the Help-octave mailing list