CFLib.org – Common Function Library Project

listFindOneOf(list, values[, delimiters])

Last updated August 06, 2005

author

Sam Curren

Version: 1 | Requires: CF6 | Library: StrLib

Description:
returns true if one of the values in the values list is found in the list.

Return Values:
Returns a boolean.

Example:

<cfoutput>
True: #ListFindOneOf("a.b.c", "f.b", ".")#<br/>
False: #ListFindOneOf("a.b.c", "d.f", ".")#<br/>
</cfoutput>

Parameters:

Name Description Required
list List of to search. Yes
values List of values to search for. Yes
delimiters List delimiter. Defaults to a comma. No

Full UDF Source:

<!---
 returns true if one of the values in the values list is found in the list.
 
 @param list      List of to search. (Required)
 @param values      List of values to search for. (Required)
 @param delimiters      List delimiter. Defaults to a comma. (Optional)
 @return Returns a boolean. 
 @author Sam Curren (telegramsam@byu.edu) 
 @version 1, August 5, 2005 
--->
<cffunction name="listFindOneOf" output="false" returntype="boolean">
    <cfargument name="list" type="string" required="yes"/>
    <cfargument name="values" type="string" required="yes"/>
    <cfargument name="delimiters" type="string" required="no" default=","/>
    <cfset var value = 0/>
    <cfloop list="#arguments.values#" index="value" delimiters="#arguments.delimiters#">
        <cfif ListFind(arguments.list, value, arguments.delimiters)>
            <cfreturn true />
        </cfif>
    </cfloop>
    <cfreturn false />
</cffunction>

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson