Replaces occurrences of substring1 in a string with substring2, in a specified scope. The search is case-sensitive.
The string, after making replacements.
Replace(string, substring1, substring2 [, scope ])
Find, REFind, ReplaceNoCase, ReplaceList, REReplace
<h3>Replace Example</h3>
<p>The Replace function returns <I>string</I> with <I>substring1</I>
replaced by <I>substring2</I> in the specified scope. This
is a case-sensitive search.
<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>#Replace(FORM.myString,
FORM.MySubstring1, FORM.mySubString2)#</cfoutput>
</cfif>
ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting
Version 6
Comments are no longer accepted for ColdFusion MX. ColdFusion 8 is the current version.
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/coldfusion/6/CFML_Reference/functions-pt266.htm