[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #52479] textscan ignores leading spaces when c
From: |
Dan Sebald |
Subject: |
[Octave-bug-tracker] [bug #52479] textscan ignores leading spaces when creating cell from string/file |
Date: |
Wed, 22 Nov 2017 17:54:29 -0500 (EST) |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0 |
Follow-up Comment #4, bug #52479 (project octave):
comment #3: OK, having read the textscan help, the takeaway is that textscan
is a superset of strread() except for possibly different treatment of
whitespace characters? Hence, it is difficult to make one or the other a main
source routine and re-using it for the other routine? strread is a script, so
is it slower in some significant way? It might be better if strread()
utilized textscan() similar to what you described with "whitespace set to
"\t\b"" (instead of going the other way with " \t\b".
Here's the white-space treatment from strread.m:
## For numeric fields, whitespace is always a delimiter, but not for text
## fields
if (isempty (regexp (format, '%\*?\d*s')))
## Add whitespace to delimiter set
delimiter_str = unique ([white_spaces delimiter_str]);
else
## Remove any delimiter chars from white_spaces list
white_spaces = setdiff (white_spaces, delimiter_str);
endif
Unlike the above, the patch I submitted is always removing the delimiters
regardless of whether the format is %s or numeric.
As an aside, it would be nice if built-in textscan() had tests just like
scripts have tests so that one could tweak some code and immediately get
feedback on what the ramifications are.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?52479>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #52479] textscan ignores leading spaces when creating cell from string/file, Motius, 2017/11/22
- [Octave-bug-tracker] [bug #52479] textscan ignores leading spaces when creating cell from string/file, Philip Nienhuis, 2017/11/22
- [Octave-bug-tracker] [bug #52479] textscan ignores leading spaces when creating cell from string/file, Dan Sebald, 2017/11/22
- [Octave-bug-tracker] [bug #52479] textscan ignores leading spaces when creating cell from string/file, Philip Nienhuis, 2017/11/22
- [Octave-bug-tracker] [bug #52479] textscan ignores leading spaces when creating cell from string/file,
Dan Sebald <=
- [Octave-bug-tracker] [bug #52479] textscan ignores leading spaces when creating cell from string/file, Philip Nienhuis, 2017/11/23
- [Octave-bug-tracker] [bug #52479] textscan ignores leading spaces when creating cell from string/file, Rik, 2017/11/23
- [Octave-bug-tracker] [bug #52479] textscan ignores leading spaces when creating cell from string/file, Rik, 2017/11/23
- [Octave-bug-tracker] [bug #52479] textscan ignores leading spaces when creating cell from string/file, Motius, 2017/11/24
- [Octave-bug-tracker] [bug #52479] textscan ignores leading spaces when creating cell from string/file, Rik, 2017/11/24
- [Octave-bug-tracker] [bug #52479] textscan ignores leading spaces when creating cell from string/file, Motius, 2017/11/24
- [Octave-bug-tracker] [bug #52479] textscan ignores leading spaces when creating cell from string/file, Dan Sebald, 2017/11/24
- [Octave-bug-tracker] [bug #52479] textscan ignores leading spaces when creating cell from string/file, Rik, 2017/11/24
- [Octave-bug-tracker] [bug #52479] textscan ignores leading spaces when creating cell from string/file, Dan Sebald, 2017/11/29
- [Octave-bug-tracker] [bug #52479] textscan ignores leading spaces when creating cell from string/file, Rik, 2017/11/29