comparison scripts/strings/index.m @ 3240:2e74d8aa1a20

[project @ 1999-04-07 18:33:23 by jwe]
author jwe
date Wed, 07 Apr 1999 18:34:20 +0000
parents c9f70d39255f
children 4f40efa995c1
comparison
equal deleted inserted replaced
3239:d54ef0aa6e82 3240:2e74d8aa1a20
37 37
38 n = 0; 38 n = 0;
39 39
40 if (isstr (s) && isstr (t)) 40 if (isstr (s) && isstr (t))
41 41
42 l_s = length (s); 42 [nr_s, l_s] = size (s);
43 l_t = length (t); 43 [nr_t, l_t] = size (t);
44
45 if (nr_s != 1 || nr_t != 1)
46 error ("index: arguments cannot be string arrays");
47 endif
44 48
45 if (l_t <= l_s) 49 if (l_t <= l_s)
46 tmp = l_s - l_t + 1; 50 tmp = l_s - l_t + 1;
47 for idx = 1 : tmp 51 for idx = 1 : tmp
48 if (strcmp (substr (s, idx, l_t), t)) 52 if (strcmp (substr (s, idx, l_t), t))