From bug-request at octave dot org Mon Nov 29 12:11:44 2004 Subject: deblank.m: remove blanks or spaces ? From: "Pascal A. Dupuis" To: bug at octave dot org Date: Mon, 29 Nov 2004 03:47:46 -0600 According to the doc, deblank remove the trailing 'blanks' from a string, where no obvious definitions is given for 'blanks'. The code implementation is to cut the string at the first ' ' (ASCII 32) or '\0' character. Wouldn't it be better to remove trailing whitespaces ? That would say tabs, form feeds, line feed, would also be removed. If you're searching for a number of a word, those entities don't make sense. I propose the following patch : ------------------------------------ --- deblank.m.orig 2004-11-26 18:53:38.000000000 +0100 +++ deblank.m 2004-11-26 18:54:40.000000000 +0100 at @ -35,7 +35,7 @@ if (isstr (s)) - k = find (s != " " & s != "\0"); + k = find (!isspace(s) & s != "\0"); if (isempty (s) || isempty (k)) t = ""; else ------------------------------------- The main difference is that all whitespaces characters are taken as candidate for removals, which seems more (to me) logical. Pascal Dupuis -- Dr. ir. Pascal Dupuis K. U. Leuven, ESAT/ELECTA (formerly ELEN): http://www.esat.kuleuven.ac.be/ Kasteelpark Arenberg, 10; B-3001 Leuven-Heverlee, Belgium Tel. +32-16-32 10 21 -- Fax +32-16-32 19 85 ------------------------------------------------------------- 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 -------------------------------------------------------------