<html>
<head>
<link href="mmres://user_interface_reference.css" rel="stylesheet" type="text/css">
<title>REPLACELIST</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">REPLACELIST</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>
Replaces occurrences of the elements from a delimited list in a string with corresponding elements from another delimited list. The search is case-sensitive.
</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>
A copy of the string, after making replacements.
</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, String 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>ReplaceList(string, list1, list2)
</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>
Find, REFind, Replace, REReplace
</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>
The list of substrings to replace is processed sequentially. If a list1 element is contained in list2 elements, recursive replacement might occur. The second example shows this.
</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;p&gt;The ReplaceList function returns &lt;I&gt;string&lt;/I&gt; with 
&lt;I&gt;substringlist1&lt;/I&gt; (e.g. &quot;a,b&quot;) replaced by &lt;I&gt;substringlist2&lt;/I&gt; 
(e.g. &quot;c,d&quot;) in the specified scope.
&lt;cfif IsDefined(&quot;FORM.MyString&quot;)&gt;
&lt;p&gt;Your original string, &lt;cfoutput&gt;#FORM.MyString#&lt;/cfoutput&gt;
&lt;p&gt;You wanted to replace the substring &lt;cfoutput&gt;#FORM.MySubstring1#
 &lt;/cfoutput&gt;
with the substring &lt;cfoutput&gt;#FORM.MySubstring2#&lt;/cfoutput&gt;.
&lt;p&gt;The result: &lt;cfoutput&gt;#Replacelist(FORM.myString,
FORM.MySubstring1, FORM.mySubString2)#&lt;/cfoutput&gt;
&lt;/cfif&gt;
&lt;form action = &quot;replacelist.cfm&quot; method=&quot;post&quot;&gt;
&lt;p&gt;String 1
&lt;br&gt;&lt;input type = &quot;Text&quot; value = &quot;My Test String&quot; name = &quot;MyString&quot;&gt;
&lt;p&gt;Substring 1 (find this list of substrings)
&lt;br&gt;&lt;input type = &quot;Text&quot; value = &quot;Test, String&quot; name = &quot;MySubstring1&quot;&gt;
&lt;p&gt;Substring 2 (replace with this list of substrings)
&lt;br&gt;&lt;input type = &quot;Text&quot; value = &quot;Replaced, Sentence&quot; name = &quot;MySubstring2&quot;&gt;
&lt;p&gt;&lt;input type = &quot;Submit&quot; value = &quot;Replace and display&quot; name = &quot;&quot;&gt; 
&lt;/form&gt;

&lt;h3&gt;Replacelist Example Two&lt;/h3&gt;
&lt;cfset stringtoreplace = &quot;The quick brown fox jumped over the lazy dog.&quot;&gt;
&lt;cfoutput&gt;
   #ReplaceList(stringtoreplace,&quot;dog,brown,fox,black&quot;, 
&quot;cow,black,ferret,white&quot;)#
&lt;/cfoutput&gt;
</pre>
         </td>
      </tr>
   </table>
   </div>
<div id="STRING">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">STRING</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, within which to replace substring</p>

  </td>
  </tr>
  </table>
</div>
<div id="LIST1">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">LIST1</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>Comma-delimited list of substrings for which to search</p>

  </td>
  </tr>
  </table>
</div>
<div id="LIST2">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">LIST2</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>Comma-delimited list of replacement substrings</p>

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

  </body>
</html>
