> > > Try to use the List functions, or extend the CFIf to be;
> > > <cfif ",#deptID#," contains ",#session.priviliges#,">
> > > which is faster than the List functions
> >
> > This would only work if the item were not the first or last
> element in the
> > list.
> >
> > Either you would have to use a reg expression or ListFind(list,
> string [,
> > delimiter]) to search a thru the list.
>
> Erm, it'd work for any instance - take this example;
>
> <cfset deptID="1,41,61,143,275,380">
> <cfset session.priliveges="41">
>
> <cfif ",#deptID#," contains ",#session.priviliges#,">
> works - it expands to;
> <cfif ",1,41,61,143,275,380," contains ",41,">
>
> While;
> <cfset session.priliveges="4">
> Fails, as it expands to
> <cfif ",1,41,61,143,275,380," contains ",4,">
>
> I use the code if I'm checking for lists supplied by CheckBoxes, or and
> denormalised data
>
> If it doesn't work, then my server has been broken for the last 2
> and a half
> years...
Sorry I didnt notice that you were adding two extra blank elements to the
string.
I tried time trials on this and over 100 iterations each the contains come
out about an average of 250 ms faster
Duane
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.