Hey Larry, had the same thought as me ;) However, containsAll() isn't
what he's after - he needs containsAny() which doesn't exist. Shame
really.
Dominic
2008/5/22 Larry Lyons <[EMAIL PROTECTED]>:
> Jeff,
>
> Take advantage of CF sitting on top of Java. Convert the lists to arrays
> using listToArray. Then use the containsAll() method of java list to see if
> all the elements of one array are present in another array. Using your
> example,
>
> <cfset list1 = listToArray("700,300,400,1100,2200") />
> <cfset list2 = listToArray("300,400") />
>
> <cfset foo = list1.containsAll(list2) />
> <!--- reset dump variable in request scope --->
> <cfset request.cfdumpinited = false />
> <cfdump expand="true" label="foo" var="#foo#" />
> <cfabort />
>
> hth,
>
> larry
>
>
>> Hi folks,
>>
>> I'm not 100% sure on all the "list" functions in CF.. so I'm hoping
>> this group can give me a little guidance.
>>
>> Ideally, I'm looking for a UDF that takes in two LISTS and returns a
>> BOOLEAN. True if ANY element in list 2 is in list 1. False if NO
>> element in list 2 is in list 1.
>>
>> I tried to search cflib.org and also looked at the avail functions for
>> lists. It needs to be optimized, so ideally breaking out of the UDF
>> once the first match is found.
>>
>> EXAMPLES:
>> list1 = 5,8,2,20
>> list2 = 4,6
>> result = FALSE
>>
>> list1 = 700,300,400,1100,2200
>> list2 = 300,400
>> result = TRUE, but breaking out of comparisions after first find
>> (300)
>>
>> list1 = 1
>> list2 = 3,4,6,1,2,11,100,101,102,103,104
>> result = TRUE, but breaking out of comparisions after element 4 = (1)
>>
>>
>> appreciate any guidance!
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;192386516;25150098;k
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:305896
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4