replaceNoCase
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 Required
A string (or variable that contains one) within which to replace substring
substring1 string Required
A string (or variable that contains one) to replace, if found.
callback any Required
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
start numeric
Default: 1
1
CF 2021+ Position to start searching in the string.
Examples Sample code invoking the replaceNoCase function
getVal = replaceNoCase("ColdFUsion", "u", "a");
writeDump(getVal); Expected Result: Expected Result: ColdFasion
<cfset getVal = replaceNoCase("ColdFusiOn", "O", "a", "ALL")>
<cfdump var="#getVal#"> Expected Result: Expected Result: CaldFusian
© 2012–present Foundeo, Inc. and the CFDocs contributors.
Licensed under the MIT License.
ColdFusion is a trademark of Adobe Systems Incorporated.
https://cfdocs.org/replacenocase