Mercurial > octave-nkf
changeset 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 | a0d98842a4d8 |
children | 2fe0f5fa8cc3 |
files | scripts/io/strread.m scripts/io/textscan.m scripts/pkg/pkg.m |
diffstat | 3 files changed, 7 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/io/strread.m Wed Jan 18 21:14:11 2012 -0800 +++ b/scripts/io/strread.m Wed Jan 18 21:14:36 2012 -0800 @@ -401,7 +401,7 @@ ## Replace TreatAsEmpty char sequences by empty strings if (! isempty (empty_str)) for ii = 1:numel (empty_str) - idz = strmatch (empty_str{ii}, words, "exact"); + idz = strncmp (empty_str{ii}, words, length (empty_str{ii})); words(idz) = {""}; endfor endif
--- a/scripts/io/textscan.m Wed Jan 18 21:14:11 2012 -0800 +++ b/scripts/io/textscan.m Wed Jan 18 21:14:36 2012 -0800 @@ -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
--- a/scripts/pkg/pkg.m Wed Jan 18 21:14:11 2012 -0800 +++ b/scripts/pkg/pkg.m Wed Jan 18 21:14:36 2012 -0800 @@ -1883,7 +1883,7 @@ endif ## Get classes in dir - class_idx = strmatch ("@", files); + class_idx = find (strncmp (files, '@', 1)); for k = 1:length (class_idx) class_name = files {class_idx (k)}; class_dir = fullfile (dir, class_name);