I build a UDF to do just that
<cfscript>
function compareLists(listIn,listToCheck) {
delim = ","; // Default
if (ArrayLen(arguments) GT 2) { delim = arguments[3]; }
listIn = delim & listin & delim;
regExp = delim & ReplaceNoCase(listToCheck, delim, delim & "|" &
delim, "ALL") & delim;
return REFindNoCase(regExp, listIn);
}
</cfscript>
Works like a charm :) HTH
<cfset listA = "1,2,3">
<cfset listB = "2,7,5">
<cfif compareLists(listA,listB)>
..
</cfif>
Note that you can optionally specify the delimeter:
<cfset listA = "1$2$3">
<cfset listB = "2$7$5">
<cfif compareLists(listA,listB,"$")>
..
</cfif>
Enjoy!
--
Scott Van Vliet
Sempra Energy
555 W. 5th St., 21st Floor
Los Angeles, CA 90013
Tel > 213.244.5205
Email > [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
"Hello Stupid, and welcome to your crappy computer."
- Strong Bad, HomestarRunner.com
> -----Original Message-----
> From: Won Lee [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, May 21, 2002 10:57 AM
> To: CF-Talk
> Subject: Most efficient way to check if two lists
>
>
> Hello,
>
> Need to find out which way is the most efficient way to see
> if a value in
> list A is a value in list B.
>
> List A = 1,2,3 VALID ListMatch
> List B = 2,3,4
>
> List A = 1,2,3 VALID ListMatch
> List B = 1,4,6
>
> List A = 1,2,3 NOT VALID ListMatch
> List B = 7,4,6
>
>
> As long as it has single matching values it is valid.
>
>
______________________________________________________________________
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists