From bug-request at octave dot org Thu Sep 22 13:16:21 2005 Subject: Re: deblank additional functionality From: "John W. Eaton" To: Bill Denney Cc: "John W. Eaton" , bug@octave.org Date: Thu, 22 Sep 2005 14:16:17 -0400 Sorry for the long delay. I applied these changes. Thanks, jwe On 26-Feb-2005, Bill Denney wrote: | Here is the patch file. Please let me know if I created it incorrectly. | | Bill | | On Sat, 26 Feb 2005, John W. Eaton wrote: | | > On 26-Feb-2005, Bill Denney wrote: | > | > | This is my first submission to the list. Is this the correct place for | > | modifications that add features to existing functions? | > | > Yes. | > | > Can you please send a context diff relative to the version you started | > with? It may not matter much for a short function like deblank, but | > for larger bits of code, it is better to deal with diffs instead of | > complete new functions (it's possible that we could lose other changes | > if we simply replaced the current code with your new version). | > | > Thanks, | > | > jwe | > | > | > | > ------------------------------------------------------------- | > Octave is freely available under the terms of the GNU GPL. | > | > Octave's home on the web: http://www.octave.org | > How to fund new projects: http://www.octave.org/funding.html | > Subscription information: http://www.octave.org/archive.html | > ------------------------------------------------------------- | > | | -- | "We stumble upon an old fashion Barber shop and Sascha gets his head | shaved and mohawk trimmed. The old timer doing the trimming is very sweet | even though he looks a bit overwhelmed by our appearance. We invite him to | the show, but he declines." -- Lucia, KMFDM, 21 Oct 2003*** deblank.m 2005-02-26 11:45:55.000000000 -0500 | --- /usr/share/octave/2.1.64/m/strings/deblank.m 2004-12-03 17:59:10.000000000 -0500 | *************** | *** 19,35 **** | | ## -*- texinfo -*- | ## at deftypefn {Function File} {} deblank (@var{s}) | ! ## Removes the trailing blanks and nulls from the at var{s} dot If @var{s} | ! ## is a matrix, at var{deblank} trims each row to the length of longest | ! ## string. If at var{s} is a cell array, it performs as if it were called | ! ## on each individual cell recursively. | ## at end deftypefn | | ## Author: Kurt Hornik | ## Adapted-By: jwe | - ## Adapted-By: Bill Denney | | ! function s = deblank (s) | | if (nargin != 1) | usage ("deblank (s)"); | --- 19,33 ---- | | ## -*- texinfo -*- | ## at deftypefn {Function File} {} deblank (@var{s}) | ! ## Removes the trailing blanks and nulls from the string at var{s} dot | ! ## If at var{s} is a matrix, @var{deblank} trims each row to the | ! ## length of longest string. | ## at end deftypefn | | ## Author: Kurt Hornik | ## Adapted-By: jwe | | ! function t = deblank (s) | | if (nargin != 1) | usage ("deblank (s)"); | *************** function s = deblank (s) | *** 39,55 **** | | k = find (! isspace (s) & s != "\0"); | if (isempty (s) || isempty (k)) | ! s = ""; | else | ! s = s(:,1:ceil (max (k) / rows (s))); | endif | | - elseif (iscell(s)) | - | - for i = 1:prod(size(s)) | - s{i} = deblank(s{i}); | - endfor | - | else | error ("deblank: expecting string argument"); | endif | --- 37,47 ---- | | k = find (! isspace (s) & s != "\0"); | if (isempty (s) || isempty (k)) | ! t = ""; | else | ! t = s(:,1:ceil (max (k) / rows (s))); | endif | | else | error ("deblank: expecting string argument"); | endif ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------