Mercurial > hg > octave-lyh
diff scripts/io/textscan.m @ 14213:a022c04f68cc
Replace to-be-deprecated strmatch occurrences with alternate code.
* strread.m, textscan.m, pkg.m: Replace to-be-deprecated strmatch occurrences
with alternate code.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Wed, 18 Jan 2012 21:14:36 -0800 |
parents | 72c96de7a403 |
children | 2fe0f5fa8cc3 |
line wrap: on
line diff
--- a/scripts/io/textscan.m +++ b/scripts/io/textscan.m @@ -104,14 +104,11 @@ whitespace = " \b\t"; else ## Check if there's at least one string format specifier - fmt = strrep (format, "%", " %"); - fmt = regexp (fmt, '[^ ]+', 'match'); - fmt = strtrim (fmt(strmatch ("%", fmt))) - has_str_fmt = all (cellfun ("isempty", strfind (strtrim (fmt(strmatch ("%", fmt))), 's'))); - ## If there is a format, AND whitespace value = empty, + has_str_fmt = regexp (format, '%[*]?\d*s', "once"); + ## If there is a string format AND whitespace value = empty, ## don't add a space (char(32)) to whitespace - if (! (isempty (args{ipos+1}) && has_str_fmt)) - args{ipos+1} = unique ([" ", whitespace]); + if (! (isempty (args{ipos+1}) && has_str_fmt)) + args{ipos+1} = unique ([" ", args{ipos+1}]); endif endif @@ -185,7 +182,7 @@ if (! isempty (endofline)) if (ischar (args{endofline + 1})) eol_char = args{endofline + 1}; - if (isempty (strmatch (eol_char, {"", "\n", "\r", "\r\n"}, 'exact'))) + if (! any (strcmp (eol_char, {"", "\n", "\r", "\r\n"}))) error ("textscan: illegal EndOfLine character value specified"); endif else