Use ListToArray, then use the built in .contains() method from Java.

[SNIP]
3. Search : I have heard people complaining that there is no find method in
Array. Actually you had it all the time. Just that it was hidden :)
You can use List.Contains() or List.indexOf() methods to achieve that. Here
is the code.

<cfset y =
ListToArray("rupesh,tom,damon,hemant,ashwin,ram,prank,sanjeev")><cfoutput>Co
ntains Hemant: #y.contains("hemant")#</cfoutput><cfoutput>Index of damon :
#y.indexof("damon")#</cfoutput>
[/SNIP]

http://coldfused.blogspot.com/2007/01/extend-cf-native-objects-harnessing.ht
ml

-----Original Message-----
From: Mike Kear [mailto:[EMAIL PROTECTED] 
Sent: Sunday, April 15, 2007 2:20 AM
To: CF-Talk
Subject: Compare two lists and if one element common ...

Is there an easy way to compare two lists and if there is at least one
common value then .. do something?

What I'm imagining is something like this:

UserPermissions = "1000,1003,1005,1006,1007"  (held in the session.user.cfc
after login) Permissions required = "1003,6048,6484,7809"  (part of the page
parameters from the CMS)

And this user has permission 1003 and the page requirements include
1003 so he's allowed here.(on the page, the permissions required would be OR
not AND)



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
ColdFusion MX7 by AdobeĀ®
Dyncamically transform webcontent into Adobe PDF with new ColdFusion MX7. 
Free Trial. http://www.adobe.com/products/coldfusion?sdid=RVJV

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:275334
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to