Search code examples
listcoldfusioncoldfusion-10lucee

ListRemoveDuplicates result has a comma at the end


When using listRemoveDuplicates in Lucee, it removes the duplicate values but still leaves the delimiter in end of the value.

Ex:

<cfset myUsers = 'sathish,sathish'>
<cfset removeDups = listRemoveDuplicates(myUsers)>

<cfdump var="#removeDups#" />

This produces the output:

sathish, 

However, when checking this same function with Adobe ColdFusion, it produces the correct value (no comma at the end):

sathish

How can I omit the comma delimiter in Lucee?


Solution

  • Surfing the Lucee documentation, I found the ListCompact() function which returns the correct value.

    <cfset myUsers = 'sathish,sathish'>
    <cfset removeDups = listCompact(listRemoveDuplicates(myUsers))>
    <cfdump var="#removeDups#" />