500
CFML Language Reference
ReplaceList
Returns string with all occurrences of the elements from the specified comma-
delimited list being replaced with their corresponding elements from another comma-
delimited list. The search is case-sensitive.
See also
Find
,
Replace
,
and
REReplace
.
Syntax
ReplaceList
(
string, list1, list2)
string
Any string.
list1
Comma-delimited list of substrings to be replaced.
list2
Comma-delimited list of replace substrings.
Usage
Note that the list of substrings to be replaced is processed one after another. In this
way you may experience recursive replacement if one of your list1 elements is
contained in list2 elements. The second example listed below demonstrates such
replacement.
Examples
<!--- This example shows the use of Replacelist --->
<HTML>
<HEAD>
<TITLE>
Replacelist Example
</TITLE>
</HEAD>
<BODY BGCOLOR=silver>
<H3>Replacelist Example</H3>
<P>The Replacelist function returns <I>string</I> with
<I>substringlist1</I> (e.g. "a,b") being replaced by <I>substringlist2
</I> (e.g. "c,d") in the specified scope.
<CFIF IsDefined("FORM.MyString")>
<P>Your original string, <CFOUTPUT>#FORM.MyString#</CFOUTPUT>
<P>You wanted to replace the substring <CFOUTPUT>#FORM.MySubstring1#
</CFOUTPUT>
with the substring <CFOUTPUT>#FORM.MySubstring2#</CFOUTPUT>.
<P>The result: <CFOUTPUT>#Replacelist(FORM.myString,
FORM.MySubstring1, FORM.mySubString2)#</CFOUTPUT>
</CFIF>
<FORM ACTION="replacelist.cfm" METHOD="POST">
Summary of Contents for COLDFUSION 4.5-CFML LANGUAGE
Page 1: ...Allaire Corporation CFML Language Reference ColdFusion 4 5...
Page 207: ...Chapter 1 ColdFusion Tags 183 CFCATCH CFTRY BODY HTML...
Page 224: ...200 CFMLLanguageReference CFOUTPUT P Text within CFOUTPUT is always shown CFOUTPUT BODY HTML...
Page 336: ...312 CFMLLanguageReference CFIF BODY HTML...
Page 404: ...380 CFMLLanguageReference DE It is morning CFOUTPUT P BODY HTML...
Page 413: ...Chapter 2 ColdFusion Functions 389 Customer BalanceDue BR CFOUTPUT CFIF BODY HTML...
Page 483: ...Chapter 2 ColdFusion Functions 459 CFOUTPUT CFLOOP BODY HTML...
Page 584: ...560 CFMLLanguageReference...
Page 594: ...570 CFMLLanguageReference...