replaceNoCase

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

replaceNoCase(String, substring1, substring2 [, scope]) → returns string

replaceNoCase Argument Reference

String string
Required

A string (or variable that contains one) within which to
replace substring

substring1 string
Required

substring2 string
Required

scope string

* one: Replace the first occurrence (default)
* all: Replace all occurrences
Values:
  • one
  • all

Examples sample code invoking the replaceNoCase function


Script Syntax

getVal = replaceNoCase("ColdFUsion", "u", "a"); 
 writeDump(getVal);

Expected Result: Expected Result: ColdFasion


Tag Syntax

<cfset getVal = replaceNoCase("ColdFusiOn", "O", "a", "ALL")> 
 <cfdump var="#getVal#">

Expected Result: Expected Result: CaldFusian


Fork me on GitHub