replaceNoCase
Description
Replaces occurrences of substring1 with substring2, in the specified scope. The search is case-insensitive.
Categories
Related
Syntax
ReplaceNoCase(string, substring1, substring2 [, scope ])
Attributes
| Attribute | Description | Required | Default |
|---|---|---|---|
| scope | one: replaces the first occurrence (default). all: replaces all occurrences. | ||
| string | A string (or variable that contains one) within which to replace substring. | ||
| substring1 | String (or variable that contains one) to replace, if found. | ||
| substring2 | String (or variable that contains one) that replaces substring1. |
Returns
A copy
of the string, after making replacements.
Example
<h3>ReplaceNoCase Example</h3>
The ReplaceNoCase function returns <I>string</I> with <I>substring1</I>
replaced by <I>substring2</I> in the specified scope.
The search/replace is case-insensitive.
<cfif IsDefined("FORM.MyString")>
Your original string, <cfoutput>#FORM.MyString#</cfoutput>
You wanted to replace the substring <cfoutput>#FORM.MySubstring1#
</cfoutput>
with the substring <cfoutput>#FORM.MySubstring2#</cfoutput>.
The result: <cfoutput>#ReplaceNoCase(FORM.myString,
FORM.MySubstring1, FORM.mySubString2)#</cfoutput>
</cfif>