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
Required

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

substring1
Required

substring2
Required

scope

* 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