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

replaceNoCase(string, substring1, callback [, scope]) → returns string

Member Function Syntax

string.replaceNoCase(substring1, callback[, scope])

Argument Reference

string string

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

substring1 string

A string (or variable that contains one) to replace, if found.

callback any

String to replace substring1 with. As of CF 2018+ you can also pass a callback function in this argument function(transform, position, original).

scope string

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

start numeric
Default: 1

CF 2021+ Position to start searching in the string.

Sample code invoking the replaceNoCase function

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

Expected Result: Expected Result: ColdFasion

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

Expected Result: Expected Result: CaldFusian

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub