ID:195112
 
//Title: findalltext()
//Credit to: Jtgibson
//Contributed by: Jtgibson


//Returns the numeric positions of all found occurrences of search within the
// given string -- i.e. like findtext, only it returns a list of all of them
// rather than just the first one found.


proc/findalltext(string, search)
var/list/L = list()

var/lastpos = 0
var/pos = findtext(string, search)
while(pos)
L += pos
lastpos = pos
pos = findtext(string, search, lastpos+1)

return(L)


//Case-sensitive version.
proc/findAllText(String,Search)
var/list/L = list()

var/lastpos = 0
var/pos = findText(String, Search)
while(pos)
L += pos
lastpos = pos
pos = findText(String, Search, lastpos+1)

return(L)