Whatever message this page gives is out now! Go check it out!

ListRemoveDuplicates

Last update:
May 18, 2026

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 1

<cfscript> 
    myList = "one,two,three,four,five,one,five,three"
    newList = listRemoveDuplicates(myList); 
    //default delimeter is ","
    //newList contains "one,two,three,four,five"
    writeOutput(newList)
</cfscript>
Output
one,two,three,four,five
Example 2
<cfscript> 
    myList = "one,two,three,four,five,ONE,TWO,THREE"
    newList = listRemoveDuplicates(myList, ",", true); 
    //newList contains "one,two,three,four,five"
    writeOutput(newList)
</cfscript>
Output
one,two,three,four,five
Example 3
<cfscript>
       myList="London,Auckland,Seattle,Geneva,Berlin,Berlin,Rome,London,Seattle";
       myList1="London,Auckland,Seattle,Geneva,Berlin,Berlin,Rome,London,Seattle,seattle,auckLand";
       myCleanList=ListRemoveDuplicates(myList);
       myCleanList1=ListRemoveDuplicates(myList1,",",false);
       WriteOutput(myCleanList & " | "); // Removes duplicate items in the list
       WriteOutput(myCleanList1); // Removes duplicate items after ignoring case
</cfscript>
Output
London,Auckland,Seattle,Geneva,Berlin,Rome | London,Auckland,Seattle,Geneva,Berlin,Rome,seattle,auckLand

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page