CFLib.org – Common Function Library Project

ListReturnDuplicatesNoCase(list[, delimiter])

Last updated October 18, 2008

author

Gerald Guido

Version: 0 | Requires: CF5 | Library: StrLib

Description:
Searches a list for case-INsensitive Duplicates and returns a list of the duplicate items or an empty string if no dupes are found. Based on Jeff Howden's' ListDeleteDuplicates()

Return Values:
Returns a string.

Example:

Example:<br />
<cfset myList = "Sister,Ghengis,Adonis,Osmisis,Frank,Zappa,sister,ghengis,adonis,osmisis,Frank,Zappa">

<cfoutput>
List of case-INsensitive dupes:
<br />#ListReturnDuplicatesNoCase(myList)#
</cfoutput>

Parameters:

Name Description Required
list List to parse. Yes
delimiter List delimiter. Defaults to a comma. No

Full UDF Source:

/**
 * Searches a list for case-INsensitive duplicates and returns a list of the duplicate items or an empty string if no dupes are found.
 * 
 * @param list      List to parse. (Required)
 * @param delimiter      List delimiter. Defaults to a comma. (Optional)
 * @return Returns a string. 
 * @author Gerald Guido (Gerald.Guido@gmail.com) 
 * @version 0, October 18, 2008 
 */
function ListReturnDuplicatesNoCase(list) {
    var i = 1;
    var delimiter = ',';
    var returnValue1 = '';
    var tmpList = list;

    if(arrayLen(arguments) GTE 2) delimiter = arguments[2];
    list = ListToArray(list, delimiter);
    for(i = 1; i LTE ArrayLen(list); i = i + 1) if(ListValueCountNoCase(tmpList, list[i]) GT 1 and not listFindNoCase(returnValue1,list[i],delimiter)) returnValue1 = ListAppend(returnValue1, list[i], delimiter);

    return returnValue1;
}

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson