ReplaceListNoCase

Description

This function replaces occurrences of the elements from a delimited list in a string with corresponding elements from another delimited list. The search is case insensitive.

Returns

A copy of the string, after making replacements.

Category

List functions

History

New in Adobe ColdFusion (2016 release)

See also

Syntax

ReplaceListNoCase(string, list1, list2,includeEmptyFields)

ReplaceListNoCase(string, list1, list2, delimiter, includeEmptyFields)

ReplaceListNoCase(string, list1, list2, delimiter_list1, delimiter_list2, includeEmptyFields)

Parameters

Parameter

Description

string

A string, or a variable that contains one, within which to replace substring.

list1

Comma-delimited list of substrings for which to search.

list2

Comma-delimited list of replacement substrings.

delimiter

Common delimiter for both search and replacement.

delimiter_list1

Delimiter for search.

delimiter_list2

Delimiter for replacement.

includeEmptyFields

When true, empty list elements are preserved.

Example 1

<cfscript>
       myString="The quick brown fox jumps over the lazy dog.";
       myList1="brown,fox,lazy";
       myList2="white,ferret,active";
       newString=ReplaceListNoCase(myString,myList1,myList2,true);
       WriteOutput(newString);
</cfscript>

Output

The quick white ferret jumps over the active dog.

Example 2

<cfscript>
       myString="The quick brown fox jumps over the lazy dog.";
       myList1="brown:fox:lazy";
       myList2="white:ferret:active";
       newString=ReplaceListNoCase(myString,myList1,myList2,":","-",false);
       WriteOutput(newString);
</cfscript>

Output

The quick white:ferret:active jumps over the dog.

Example 3

<cfscript>
       myString="The quick brown fox jumps over the lazy dog.";
       myList1="brown:fox,lazy";
       myList2="white:ferret:active,verylazy";
       newString=ReplaceListNoCase(myString,myList1,myList2,":","-",true);
       WriteOutput(newString);
</cfscript>

Output

The quick white:ferret:active, verylazy fox jumps over the lazy dog.

Using member function

<cfscript>
       myString="The quick brown fox jumps over the lazy dog.";
       myList1="brown,fox,lazy";
       myList2="white,ferret,active";
       newString=myString.replaceListNoCase(myList1,myList2);
       WriteOutput(newString);
</cfscript>

 Adobe

Get help faster and easier

New user?