– Common Function Library Project

ReplaceListNoCase(str, list1, list2)

Last updated December 11, 2001


Matthew Walker

Version: 2 | Requires: CF5 | Library: StrLib

Returns string with all occurrences of the elements from the specified comma-delimited list being replaced with their corresponding elements from another comma-delimited list. The search is case-insensitive. If an item does not appear in the second list, the item from the first list is replaced with an empty string. Chr(31) is used to mark empty elements, so if there is the possibility of a string containing (and needing) this character, the function should not be used as is.

Return Values:
Returns a modified list.


<cfset orig = "It's too soon to say">
original list: #orig#<br>
modified list: #ReplaceListNoCase(orig, "it's,soon,say", "early,tell")#


Name Description Required
str The string to modify. Yes
list1 The list of terms to search for. Yes
list2 The list of corresponding items to use as replacements. Yes

Full UDF Source:

 * Replace all occurences of elements in list one with elements in list two. Case insensitive version of ReplaceList.
 * Modified by Raymond Camden
 * @param str 	 The string to modify. 
 * @param list1 	 The list of terms to search for. 
 * @param list2 	 The list of corresponding items to use as replacements. 
 * @return Returns a modified list. 
 * @author Matthew Walker ( 
 * @version 2, December 11, 2001 
function ReplaceListNoCase(str,list1,list2) {
	var i = 1;
	var newval = "";
	for(; i lte listLen(list1); i=i+1) {
		if(i gt listLen(list2)) newval = "";
		else newval = listGetAt(list2,i);
		str = ReplaceNoCase(str,listGetAt(list1,i),newval,"all");		
	return str;
blog comments powered by Disqus


Latest Additions

Kevin Cotton added
May 5, 2016

Raymond Camden added
April 25, 2016

Chris Wigginton added
January 18, 2016

Gary Stanton added
November 19, 2015

Sebastiaan Naafs - van Dijk added
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson