Newbie: find, search command

Erik Hansen erikhans08 at yahoo.com
Mon Dec 20 14:57:04 EST 2004


--- "D.Rothe" <drothe at optusnet.com.au> wrote:

> at the end of the field I simply used "filter
> theField without empty".

"That's brilliant!" -- Ken Ray

yes it is.

> on mouseUp
>  do FindData(tString, tData)
> end mouseUp
> 
> function FindData pStringToFind, pDataToSearch
> repeat for each line tLine in pDataToSearch
> if pStringToFind is in tLine then put tLine &
> cr after tFoundData
> end repeat
> put tFoundData into fld "List"
> filter fld "List" without empty
> end FindData

a function is generally used
to "return" a value:

on mouseUp
  put FindData(tString, tData) into fld "List"
end mouseUp

function FindData pStringToFind, pDataToSearch
 repeat for each line tLine in pDataToSearch
  if pStringToFind is in tLine then
    put tLine & cr after tFoundData
  end if
 end repeat
 filter tFoundData without empty
 return tFoundData
end FindData

or use a handler (no parens for params):

on mouseUp
  FindData tString, tData
end mouseUp

on FindData pStringToFind, pDataToSearch
  ...
  filter tFoundData without empty
  put tFoundData into fld "List"
end findData

different forms, same result.

Erik Hansen



=====
erik at erikhansen.org    http://www.erikhansen.org

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the use-livecode mailing list