Search Values of Array in "One Go"

Brian Milby brian at milby7.com
Fri Aug 25 23:45:52 EDT 2017


I created a stack to do some testing to see about making a function that
could do multiple types of tests.  What I found was that adding another if
at that point added about 6% to the search time and a second level (else
if) added another 10% (16% total).  (I added a parameter for search type -
"String".  I used "String2" to get a second option, but used the same
test).  When I used number instead of strings it was a little lower, but
not much (5.5% and 11% total)


> In terms of generalizing that function - then the key line which checks
> whether an element matches is:
>
>     else if tElement contains pNeedle then
>
> One could imagine that this could be an arbitrary predicate - pNeedle
> doesn't have to be a string, so could be an array representing a AND / OR
> style query; or could be a regex (in which case you'd use matchText).
>
> Warmest Regards,
>
> Mark.
>
> --
> Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
> LiveCode: Everyone can create apps
>



More information about the Use-livecode mailing list