Created
January 14, 2011 03:41
-
-
Save ppshein/779135 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cffunction name="ListGetDifferent" output="yes"> | |
<cfargument name="mainList" required="Yes" /> | |
<cfargument name="compareList" required="Yes" /> | |
<cfargument name="CompareType" required="Yes" default="Same" /> | |
<cfset ReturnList = "" /> | |
<cfif CompareType EQ "Same"> | |
<cfloop list="#mainList#" index="i"> | |
<cfif ListFindNoCase(compareList,i)> | |
<cfset ReturnList = ListAppend(ReturnList,i) /> | |
</cfif> | |
</cfloop> | |
<cfelse> | |
<cfloop list="#mainList#" index="i"> | |
<cfif NOT ListFindNoCase(compareList,i)> | |
<cfset ReturnList = ListAppend(ReturnList,i) /> | |
</cfif> | |
</cfloop> | |
</cfif> | |
<cfreturn ReturnList /> | |
</cffunction> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage of UDF is as follow.
ListGetDifferent("1,2,3,4,5", "1,3,5", "Same")
ListGetDifferent("1,2,3,4,5", "1,3,5", Differ")#