I would like to find those elements of the array that contains a specific word.
I thought FILTER would do this.
I tested out using filter with the following code:
Code: Select all
on dosearch
local thesearch, sctext
--present answer dlog for search
ask "Please enter the word you wish to search for:" titled "Search"
put it into thesearch
if thesearch is not empty then
put ctext into sctext
put "*" & thesearch & "*" into thesearch
filter elements of sctext with thesearch
put the keys of sctext
end if
end dosearch
"ctext" is a global
Expecting to get the keys of all the elements of the array containing the search word.
stepping through the handler when I step over the filter command the array is emptied.
The array I am testing this on does have the search word in many of the elements
what am I doing wrong?