Mercurial > hg > octave-nkf
diff scripts/strings/findstr.m @ 11587:c792872f8942
all script files: untabify and strip trailing whitespace
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 20 Jan 2011 17:35:29 -0500 |
parents | fd0a3ac60b0e |
children | 17b702fae303 |
line wrap: on
line diff
--- a/scripts/strings/findstr.m +++ b/scripts/strings/findstr.m @@ -60,22 +60,22 @@ s = t; t = tmp; endif - + l_s = length (s); l_t = length (t); - + if (l_t == 0) ## zero length target: return empty set v = []; - + elseif (l_t == 1) ## length one target: simple find v = find (s == t); - + elseif (l_t == 2) ## length two target: find first at i and second at i+1 v = find (s(1:l_s-1) == t(1) & s(2:l_s) == t(2)); - + else ## length three or more: match the first three by find then go through ## the much smaller list to determine which of them are real matches @@ -96,7 +96,7 @@ if (all (size (s) != size (t))) t = t.'; endif - + ## determine which ones to keep keep = zeros (size (v)); ind = 0:l_t-1; @@ -127,7 +127,7 @@ endif ## Always return a column vector, because that's what the old one did. - if (rows (v) > 1) + if (rows (v) > 1) v = v.'; endif