Search question

Dan Friedman dan at clearvisiontech.com
Mon Jan 30 12:43:25 EST 2012


Marty,

I don't know if it's the fastest way, but here's one way to do it.  Pass with function your tab-delimited list and what you are looking to find in fields 1,3 and 4 and it will return a list of the lines numbers that match.  Hope it helps...

function getTheMatches tList,findThis
  set the itemDel to tab
  put "" into foundList
  put 0 into i
  repeat for each line tLine in tList
    add 1 to i
    if item 1 of tLine = findThis then
      if item 3 of tLine = findThis then
        if item 4 of tLine = findThis then
          put i & cr after foundList
        end if
      end if
    end if
  end repeat
  delete last line of foundList
  
  return foundList
end getTheMatches



> Let's say I have a tab delimited list with 4 items and I want to find a 
> match to my search string, except I don't care what item 2 is - it could 
> be a number, a word or be empty, but I want to find the occurrences 
> where items 1, 3 & 4 match. What's the  fastest way to do that?




More information about the use-livecode mailing list