Description

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

Returns

A copy of the string, after making replacements.

Category

String functions

Function syntax

ReplaceNoCase(string, substring, callback, [ scope ])

See also

FindREFindReplaceReplaceListREReplace

History

ColdFusion (2018 release): Introduced named parameters.

Parameters

Parameter

Description

string

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

substring

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

callback

Function to replace string. Parameters are:

  • transform
  • position
  • original

scope

  • one: replaces the first occurrence (default).
  • all: replaces all occurrences.

Example

<cfscript>
    myStr="hAppy app application apply appreciate appreciation Apprentice";
    outStr = replacenocase( myStr, "app", function (transform, position, original) { return UCase(transform); }
, "all");
    writeoutput("Output:" & outStr);
</cfscript>

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy