We have a UDF close to that - ListCompare - " Compares one list against
another to find the elements in the first list that don't exist in the
second list. Performs the same funciton as the custom tag of the same
name." However, I think you want this:
function existsInList2(l1,l2) {
var i = 1;
var newList = l1;
for(i=1; i lte listlen(l1); i=i+1) {
if(listFind(l2,listGetAt(l1,i)) newList =
listDeleteAt(newList,i);
}
return newList;
}
You would want to add support for dynamic delimiters of course. Several
examples at cflib.org show how to do this. I wrote this _very_ quickly,
so forgive any typos. You may also want to consider changing listFind to
listFindNoCase if you don't care about case. (Or even easier, make it
one more optional arg, and if you don't care, just ucase l1 and l2.)
=======================================================================
Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc
Member of Team Macromedia
Email : [EMAIL PROTECTED]
Blog : www.camdenfamily.com/morpheus/blog
Yahoo IM : morpheus
"My ally is the Force, and a powerful ally it is." - Yoda
> -----Original Message-----
> From: Dowdell, Jason G [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 06, 2003 9:06 AM
> To: CF-Talk
> Subject: RE: Comparing two listvars and deleting dups
>
>
> Correct me if I'm wrong but that doesn't do what I'm asking.
>
> I want to remove all items in ListVar1 that appear in
> ListVar2. They are not already duplicated in ListVar1.
>
> ~Jason
>
> -----Original Message-----
> From: Raymond Camden [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 06, 2003 10:01 AM
> To: CF-Talk
> Subject: RE: Comparing two listvars and deleting dups
>
>
> http://www.cflib.org/udf.cfm?ID=532
> and
> http://www.cflib.org/udf.cfm?ID=533
>
> ==============================================================
> =========
> Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc
> Member of Team Macromedia
>
> Email : [EMAIL PROTECTED]
> Blog : www.camdenfamily.com/morpheus/blog
> Yahoo IM : morpheus
>
> "My ally is the Force, and a powerful ally it is." - Yoda
>
> > -----Original Message-----
> > From: Dowdell, Jason G [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, March 06, 2003 8:55 AM
> > To: CF-Talk
> > Subject: Comparing two listvars and deleting dups
> >
> >
> > Anyone have code off the top of their head to delete
> > duplicate values from 2 lists. Here's an example.
> >
> > I want to delete all of the list items in ListVar1 that
> > appear in ListVar2
> >
> > ListVar1 = a,b,c,d,e
> > ListVar2 = c,e
> >
> > Any suggestions?
> > ~Jason
> >
> >
> >
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for
dependable ColdFusion Hosting.
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4