ReplaceNoCase

Description

Returns string with occurrences of substring1 replaced, regardless of case, matching with substring2 in the specified scope.

Category

String functions

Syntax

ReplaceNoCase(string, substring1, substring2 [, scope ]) 

See also

REFind, Replace, ReplaceList, REReplace

Parameters

Parameter
Description
string
A string
substring1
String to be replaced
substring2
String that replace occurrences of substring1
scope
Defines how to complete the replace operation:
  • ONE    Replace only the first occurrence (default)
  • ALL    Replace all occurrences

Example

<!--- This example shows the use of ReplaceNoCase --->
<html>
<head>
<title>
ReplaceNoCase Example
</title>
</head>

<body bgcolor = silver>
<H3>ReplaceNoCase Example</H3>

<P>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")>
<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>#ReplaceNoCase(FORM.myString,
FORM.MySubstring1, FORM.mySubString2)#</cfoutput>
</cfif>
...