Switch to edit mode.
Name(s): index_all1: "index_all(string,target) -- returns list of positions of target in string."
2: "Usage: $string_utils:index_all(<string,pattern>)"
3: " $string_utils:index_all(\"aaabacadae\",\"a\")"
4: if (length(args) != 2)
5: return E_ARGS
6: elseif (typeof(args[1]) != $STR || typeof(args[2] != $STR))
7: return E_TYPE
8: else
9: line = args[1]
10: pattern = args[2]
11: where = {}
12: place = -1
13: length = length(line)
14: next = 0
15: while ((place = index(line[next + 1..length], pattern)) != 0)
16: where = {@where, place + next}
17: next = place + next + length(pattern) - 1
18: endwhile
19: return where
20: endif
21: "Last modified by Dax (#789) on Mon Aug 7 21:45:45 2006 MDT."