Description
Removes duplicate values (if they exist) in a list.
Returns
List sans duplicate values
History
ColdFusion 10: Added this function
Syntax
ListRemoveDuplicates(list[, delimiter] [, ignoreCase])
Properties
Parameter | Description |
---|---|
list |
Required. List of objects. |
delimiter |
Optional. Character(s) that separate list elements. The default value is comma. . |
ignoreCase |
Optional. If true , ignores the case of strings in the list. By default the value is set to false . |
Example
<cfscript> myList = "one,two,three,four,five,one,five,three" newList = listremoveduplicates(myList); //default delimeter is "," //newList contains "one,two,three,four,five" </cfscript> |
<cfscript> myList = "one,two,three,four,five,ONE,TWO,THREE" newList = listremoveduplicates(myList, "," , true ); //newList contains "one,two,three,four,five" </cfscript> |
Originally published at The Scotto Grotto. You can comment here or there.