# HG changeset patch # User Philip Nienhuis # Date 1428354341 -7200 # Node ID f68c3a62e42c8681687b986def23b0a993a7764f # Parent 42c3a08293245811e022cad481d23034f3895e55 strread.m: properly process traling delimiters in case of MultipleDelimsAsOne parameter (bug #44750) diff --git a/scripts/io/strread.m b/scripts/io/strread.m --- a/scripts/io/strread.m +++ b/scripts/io/strread.m @@ -805,7 +805,7 @@ out = ostrsplit (text, sep, mult_dlms_s1); if (index (sep, eol_char)); out = strrep (out, char (255), ''); endif ## In case of trailing delimiter, strip stray last empty word - if (! isempty (out) && any (sep == text(end))) + if (! isempty (out) && any (sep == text(end)) && ! mult_dlms_s1) out(end) = []; endif @@ -937,6 +937,11 @@ %! assert (c', [13, 24, 34]); %! assert (d', [15, 25, 35]); +## Bug #44750 +%!test +%! assert (strread ('/home/foo/','%s','delimiter','/','MultipleDelimsAsOne',1), ... +%! {"home"; "foo"}); + ## delimiter as sq_string and dq_string %!test %! assert (strread ("1\n2\n3", "%d", "delimiter", "\n"),