ListDeleteDuplicatesNoCase(list)
Last updated July 2, 2008
Version: 1 | Requires: ColdFusion 5 | Library: StrLib
Description:
Simply pass it a list and optional delimiter. The function will look for case-insensitive matches, removing any it finds, and return a new list without duplicates.
Return Values:
Returns a list.
Example:
<cfoutput>
List before removing dupes: #myList#<br>
List after removing dupes: #ListDeleteDuplicatesNoCase(myList)#
</cfoutput>
Parameters:
| Name | Description | Required |
|---|---|---|
| list | List to be modified. | Yes |
Full UDF Source:
<cfscript>
/**
* Case-insensitive function for removing duplicate entries in a list.
* Based on dedupe by Raymond Camden
*
* @param list List to be modified. (Required)
* @return Returns a list.
* @author Jeff Howden (cflib@jeffhowden.com)
* @version 1, July 2, 2008
*/
function ListDeleteDuplicatesNoCase(list) {
var i = 1;
var delimiter = ',';
var returnValue = '';
if(ArrayLen(arguments) GTE 2)
delimiter = arguments[2];
list = ListToArray(list, delimiter);
for(i = 1; i LTE ArrayLen(list); i = i + 1)
if(NOT ListFindNoCase(returnValue, list[i], delimiter))
returnValue = ListAppend(returnValue, list[i], delimiter);
return returnValue;
}
</cfscript>
Search CFLib.org
Latest Additions
Adam Cameron added
composeDateTime
19 day(s) ago
Chris Weller added
convertQueryStri...
a while ago
Greg Nettles added
arrayDiff
a while ago
Nathan Dintenfass added
ArrayOfStructsSo...
a while ago
Top Rated
backupDatabase
Rated 5.0, 36 time(s)
indentXml
Rated 5.0, 10 time(s)
deAccent
Rated 5.0, 6 time(s)
countArbitraryDa...
Rated 5.0, 5 time(s)