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

setToList

Last update:
May 18, 2026
Converts a Set to a list string.

Description

Produces a comma-delimited list from a set.

Returns

String.

Category

ColdFusion Set built-in functions

Function syntax

setToList(set)
set.toList()

Parameters

ParameterDescription
setSet to convert.
delimiterThe delimiter to appear in the output.

See also

Example

The following example uses this API in cfscript (syntax: setToList(set)).

<cfscript>
    s = setNew();
    s.add("one");
    s.add("two");
    s.add("three");

    listForm = setToList(s,";");
    writeOutput(listForm); // e.g. "one;two;three" 
</cfscript> 
      

Real-world example

Pass unique category codes to a legacy tag or function that expects a list attribute.

 <cfscript>
    function categoryListForTag(required any categorySet) {
        return setToList(categorySet, ",");
    }

    cats = setNew();
    cats.add("news");
    cats.add("sports");

    // Hypothetical: <cfmodule categories="#categoryListForTag(cats)#">
    writeOutput(categoryListForTag(cats));
</cfscript>
      

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