– 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;


Latest Additions

Raymond Camden added
November 04, 2017

Leigh added
May 11, 2016

Raymond Camden added
May 10, 2016

Kevin Cotton added
May 05, 2016

Raymond Camden added
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson