<html>
<head>
<link href="mmres://user_interface_reference.css" rel="stylesheet" type="text/css">
<title>LISTCONTAINS</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
   <div id="Description">
   <table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
      <tr> 
         <td valign="top" class="name">LISTCONTAINS</td>
         <td valign="top" nowrap class="compatibility">&nbsp;</td>
      </tr>
      <tr>
         <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
      </tr>


    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Description</span>
<p>
Determines the index of the first list element that contains a specified substring.
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Returns</span>
<p>
Index of the first list element that contains substring. If not found, returns zero.
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Category</span>
<p>
List functions
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Function syntax</span><pre>ListContains(list, substring [, delimiters ])
</pre>    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">See also</span>
<p>
ListContainsNoCase, ListFind; "Lists" in Chapter&#160;3, "Using ColdFusion Variables," in ColdFusion MX Developer's Guide 
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Parameters</span>
<p>

</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Usage</span>
<p>
ColdFusion ignores empty list elements; thus, the list &quot;a,b,c,,,d&quot; has four elements.
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Example</span><pre>&lt;!--- This example shows differences between ListContains and ListFind ---&gt;
&lt;!--- Create a list composed of the elements one, two, three. ----&gt;
&lt;cfset aList = &quot;one&quot;&gt;
&lt;cfset aList = ListAppend(aList, &quot;two&quot;)&gt;
&lt;cfset aList = ListAppend(aList, &quot;three&quot;)&gt;
&lt;p&gt;Here is a list: &lt;cfoutput&gt;#aList#&lt;/cfoutput&gt;
&lt;p&gt;&lt;strong&gt;ListContains&lt;/strong&gt; checks for substring &quot;wo&quot; in the list 
elements:
&lt;cfoutput&gt;
   &lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Substring &quot;wo&quot; is in 
&lt;B&gt;element #ListContains(aList, &quot;wo&quot;)#&lt;/B&gt; of list.
&lt;/cfoutput&gt;
&lt;p&gt;ListFind cannot check for a substring within an element; therefore, in the 
   code, it does not find substring &quot;wo&quot; (it returns 0):
&lt;cfoutput&gt;
   &lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Substring &quot;wo&quot; is in &lt;b&gt;element #ListFind(aList, &quot;wo&quot;)#
   &lt;/b&gt; of the list.&lt;/cfoutput&gt;
&lt;p&gt;&lt;p&gt;If you specify a string that exactly equals an entire list element, such
   as &quot;two&quot;, both ListContains and ListFind find it, in the second element:
   &lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;strong&gt;ListContains&lt;/strong&gt;: 
&lt;cfoutput&gt;
The string &quot;two&quot; is in &lt;b&gt;element #ListContains(aList, &quot;two&quot;)#&lt;/b&gt; of the list.
&lt;/cfoutput&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;p&gt;&lt;strong&gt;ListFind&lt;/strong&gt;: 
&lt;cfoutput&gt;
The string &quot;two&quot; is in &lt;b&gt;element #ListFind(aList, &quot;two&quot;)#&lt;/b&gt; of the list.
&lt;/cfoutput&gt;
</pre>
         </td>
      </tr>
   </table>
   </div>
<div id="LIST">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">LIST</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>


<p>A list or a variable that contains one.</p>

  </td>
  </tr>
  </table>
</div>
<div id="SUBSTRING">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">SUBSTRING</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>


<p>A string or a variable that contains one. The search is case-sensitive.</p>

  </td>
  </tr>
  </table>
</div>
<div id="DELIMITERS">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">DELIMITERS</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>


<p>A string or a variable that contains one. Character(s) that separate list elements. The default value is comma. </p>
<p>If this parameter contains more than one character, ColdFusion processes each occurrence of each character as a delimiter. </p>

  </td>
  </tr>
  </table>
</div>

  </body>
</html>
