CFLib.org – Common Function Library Project

ArrayContainsNoCase(arrayToSearch, valueToFind)

Last updated March 31, 2003

Version: 1 | Requires: ColdFusion 5 | Library: DataManipulationLib

 
Rated 1 time(s). Average Rating: 2.0

Description:
Returns the index of the first item that contains a specified substring. The search is case-insensitive. If the substring is not found in an Array, it returns zero (0).

Return Values:
Returns a number.

Example:

view plain print about
<cfset arrN = arrayNew(1)>
<cfset arrN[1] = "A">
<cfset arrN[2] = "AP">
<cfset arrN[3] = "B">
<cfset arrN[4] = "APPLE">
<cfset arrN[5] = "BOY">
<cfset arrN[6] = "BOUGHT">

<cfoutput>#ArrayContainsNoCase(arrN,"oU")#</cfoutput>

Output:
6

Parameters:

Name Description Required
arrayToSearch Array to search. Yes
valueToFind Value to look for. Yes

Full UDF Source:

view plain print about
<cfscript>
/**
 * Returns the index of the first item in an array that contains a specified substring.
 * Mods by RCamden
 * 
 * @param arrayToSearch      Array to search. (Required)
 * @param valueToFind      Value to look for. (Required)
 * @return Returns a number. 
 * @author Sudhir Duddella (skduddella@hotmail.com) 
 * @version 1, March 31, 2003 
 */

function ArrayContainsNoCase(arrayToSearch,valueToFind){
    var arrayList = "";

    arrayList = ArrayToList(arrayToSearch);
    return ListContainsNoCase(arrayList,valueToFind);                
}
</cfscript>
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Tayo Akinmade Tayo Akinmade added
arrayTrim
11 day(s) ago

Will Belden Will Belden added
longTime
17 day(s) ago

James Sleeman James Sleeman added
quickSort
27 day(s) ago

Ben Forta Ben Forta added
GetHostAddress
30 day(s) ago

Top Rated

Darwan Leonardo Sitepu EksporSQLData
Rated 5.0, 16 time(s)

Darwan Leonardo Sitepu backupDatabase
Rated 5.0, 13 time(s)

Barney Boisvert indentXml
Rated 5.0, 10 time(s)

Kevin Pepperman generateSsccAsn
Rated 5.0, 4 time(s)

Created by Raymond Camden / Design by Justin Johnson