ListReturnDuplicates(list[, delimiter])
Last updated October 18, 2008
Version: 0 | Requires: CF5 | Library: StrLib
Description:
Searches a list for case- sensitive Duplicates and returns a list of the duplicate items or and empty string if no dupes are found. Based on Jeff Howden's' ListDeleteDuplicates()
Return Values:
Returns a string.
Example:
Example:
<cfset myList = "Sister,Ghengis,Adonis,Osmisis,Frank,Zappa,sister,ghengis,adonis,osmisis,Frank,Zappa">
<cfoutput>
List of case-sensitive dupes:
<br />#ListReturnDuplicates(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- sensitive 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 ListReturnDuplicates(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(ListValueCount(tmpList, list[i]) GT 1 and not listFind(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