View comments | RSS feed

ReplaceNoCase

Description

Replaces occurrences of substring1 with substring2, in the specified scope. The search is case-insensitive.

Return value

A copy of the string, after making replacements.

Category

String functions

Syntax

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

See also

Find, REFind, Replace, ReplaceList, REReplace

Parameters

Parameter Description
string
A string within which to replace substring
substring1
String, or a variable that contains one, to replace.
substring2
String or a variable that contains one, that replaces substring1
scope
  • one: Replace the first occurrence (default)
  • all: Replace all occurrences

Example

<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>

ColdFusion 9 | ColdFusion 8 | 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.

Comments


wickedXen said on May 13, 2003 at 5:25 AM :
Parameters Table errata:
STRING is defined as "A string or a variable that contains one. String in which to search" SUBSTRING1 has also been defined with this definition.

The Descriptions could be clarified as:

STRING:
A string (or variable that contains a string)within which to locate and replace a specified substring.

SUBSTRING1:
A Portion of a String, or a variable that contains one, that is to be replaced upon discovery.

SUBSTRING2: A String or a variable containing a string that is to replace specified occurance of SUBSTRING1.

 

RSS feed | 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-pt268.htm