Mercurial > hg > octave-avbm
changeset 11343:5e5c513ea4c5
strread.m: Don't require space between format specifiers.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Fri, 10 Dec 2010 19:59:25 -0500 |
parents | cc7f30d3fd01 |
children | cac58372d547 |
files | scripts/ChangeLog scripts/io/strread.m |
diffstat | 2 files changed, 9 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2010-12-10 Ben Abbott <bpabbott@mac.com> + + * io/strread.m: Don't require space between format specifiers. + 2010-12-10 Rik <octave@nomad.inbox5.com> * testfun/speed.m: Eliminate line continuation in function definition.
--- a/scripts/io/strread.m +++ b/scripts/io/strread.m @@ -187,6 +187,7 @@ endif ## Determine the number of words per line + formatstr = strrep (formatstr, "%", " %"); [~, ~, ~, fmt_words] = regexp (formatstr, "[^\\s]+"); num_words_per_line = numel (fmt_words); @@ -246,6 +247,10 @@ endfunction %!test +%! [a, b] = strread ("1 2", "%f%f"); +%! assert (a == 1 && b == 2); + +%!test %! str = "# comment\n# comment\n1 2 3"; %! [a, b] = strread (str, '%d %s', 'commentstyle', 'shell'); %! assert (a, [1; 3]);