Raj KAJ (scottobear) wrote,
Raj KAJ
scottobear

Thank you, CF 10! This makes things much simpler.

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>

via

Originally published at The Scotto Grotto. You can comment here or there.

Tags: code
Subscribe
  • Post a new comment

    Error

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 0 comments