replaceListNoCase

Replaces occurrences of the elements from a delimited list
in a string with corresponding elements from another delimited
list. The search is case-insensitive.

replaceListNoCase(String, list1, list2, includeEmptyFields)
replaceListNoCase(String, list1, list2, delimiter, includeEmptyFields)
replaceListNoCase(String, list1, list2, delimiterList1, delimiterList2, includeEmptyFields) → returns String

This function requires Adobe ColdFusion 2016 and up. Not supported on Lucee, OpenBD, etc.

Argument Reference for the replaceListNoCase function

String

Required: Yes
A string, or a variable that contains one, within which to replace substring

list1

Required: Yes
List of substrings for which to search

list2

Required: Yes
List of replacement substrings

delimiter

Required: No
Default: ,
Common delimiter for both search and replacement.

delimiterList1

Required: No
Default: ,
Delimiter for search.

delimiterList2

Required: No
Default: ,
Delimiter for replacement.

includeEmptyFields

Required: No
Default: false
When true, zero-length list elements are preserved.

Examples sample code invoking the replaceListNoCase function


Tag Example

<cfset local.myString = "My test string" /> 
 <cfset local.MySubstring1 = "Test, String" /> 
 <cfset local.mySubString2 = "Replaced, Sentence" /> 
 <p>The result: <cfoutput>#replaceListNoCase(local.myString, local.MySubstring1, local.mySubString2)#</cfoutput> 

Fork me on GitHub