ListFindNoCase

Returns the index of the first occurrence of a value within a list. Returns 0 if no value was found. The search is case-insensitive.

See also ListContains and ListFind.

Syntax

ListFindNoCase(list, value [, delimiters ])
list

List being searched.

value

Number or string being sought among elements of list.

delimiters

Set of delimiters used in list.

Examples

<!--- This example uses ListFind and ListFindNoCase to see if a
substring exists in a list --->
<HTML>
<HEAD>
<TITLE>ListFind Example</TITLE>
</HEAD>

<BASEFONT FACE="Arial, Helvetica" SIZE=2>
<BODY  bgcolor="#FFFFD5">
<H3>ListFind Example</H3>
<P>This example uses ListFind or ListFindNoCase to see if an exact string 
exists
in a list

<FORM ACTION="listfind.cfm" METHOD="POST">
<P>Try changing the case in Leary's last name:
<BR><INPUT TYPE="Text" size=25 NAME="myString" VALUE="Hove">
<P>Pick a search type:
    <SELECT NAME="type">
        <OPTION VALUE="ListFind" SELECTED>Case-Sensitive
        <OPTION VALUE="ListFindNoCase">Case-Insensitive
    </SELECT>
<INPUT TYPE="Submit" NAME="" VALUE="Search Employee List">
</FORM>
<!--- wait to have a string for searching defined --->
<CFIF IsDefined("form.myString") and IsDefined("form.type")>

<CFQUERY Name="SearchEmpLastName" DATASOURCE="HRAPP">
SELECT     FirstName, RTrim(LastName) AS LName,  StartDate
FROM     Employees
</CFQUERY>

<CFSET myList = ValueList(SearchEmpLastName.LName)>
<!--- Is this case-sensitive or case-insensitive searching --->
<CFIF form.type is "ListFind">
    <CFSET temp = ListFind(myList, form.myString)>
    <CFIF temp is 0>
        <H3>An employee with that exact last name was not found</H3>
    <CFELSE>
        <CFOUTPUT>
        <P>Employee #ListGetAt(ValueList(SearchEmpLastName.FirstName), 
temp)#
        #ListGetAt(ValueList(SearchEmpLastName.LName), temp)#
        started 
#DateFormat(ListGetAt(ValueList(SearchEmpLastName.StartDate), temp))#.
        <P>This was the first employee found under this case-sensitive 
last name search.
        </CFOUTPUT>
    </CFIF>
<CFELSE>
    <CFSET temp = ListFindNoCase(myList, form.myString)>
    <CFIF temp is 0>
        <H3>An employee with that exact last name was not found</H3>
    <CFELSE>
        <CFOUTPUT>
        <P>Employee #ListGetAt(ValueList(SearchEmpLastName.FirstName), 
temp)#
        #ListGetAt(ValueList(SearchEmpLastName.LName), temp)#, 
        started on 
#DateFormat(ListGetAt(ValueList(SearchEmpLastName.StartDate), temp))#.
        <P>This was the first employee found under this case-insensitive 
last name search.
        </CFOUTPUT>
    </CFIF>
</CFIF>
</CFIF>

</BODY>
</HTML>