Search Values of Array in "One Go"

Alex Tweedly alex at tweedly.net
Sat Aug 26 10:04:16 EDT 2017


I think regex (or multiple string comparisons) is too limited a way to go.

I would want to be able to do numeric comparisons, range comparisons, etc.

e.g. x is a number, x<25, 24 < x < 33, etc.

-- Alex.

On 26/08/2017 05:05, Brian Milby via use-livecode wrote:
> tElement isn't the part that would change (you are still searching against
> a single value in the array), you would need to modify the comparison to
> allow for pNeedle to contain multiple values and the operators.  It would
> probably be easier to modify to use a RegEx.  If you have 2 comma separated
> items, you could use something like the following (I'm sure the more
> experienced can offer much better ways though):
>
> *if* (tElement contains item 1 of pNeedle) or (tElement contains item 2 of
> pNeedle) *then*
>
> On Fri, Aug 25, 2017 at 10:41 PM, Sannyasin Brahmanathaswami via
> use-livecode <use-livecode at lists.runrev.com> wrote:
>
>> OK I will bite
>>
>> what would an array representing an "AND/OR"
>> style query look like such that if used as a predicate
>>
>> for
>>
>>       else if tElement contains pNeedle then
>>
>> it would return true/false
>>
>> How would you have to construct "tElement"
>>
>> ??
>>
>>
>>
>> Mark: 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).
>>
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list