Description

Changes a list delimiter.

Returns

A copy of the list, with each delimiter character replaced by newDelimiter.

History

ColdFusion (2018 release): Made the following changes:

  • Parameter name includeEmptyValues renamed to includeEmptyFields.
  • Parameter name new_delimiter renamed to newDelimiter.

Category

List functions

Function syntax

ListChangeDelims(list, newDelimiter [, delimiters, includeEmptyFields ])

See also

ListFirstListQualify; Lists in the Developing ColdFusion Applications

Parameters

Parameter

Description

includeEmptyFields

Optional. Set to yes to include empty values.

list

A list or a variable that contains one.

newDelimiter

Delimiter string or a variable that contains one. Can be an empty string. ColdFusion processes the string as one delimiter.

delimiters

A string or a variable that contains one. Characters that separate list elements. The default value is comma. If this parameter contains more than one character, ColdFusion processes each occurrence of each character as a delimiter.

Example

<cfscript>
       myList="a,b,c,d,e";
       myChangeDelims=ListChangeDelims(myList,"|"); //Replace comma in the list with pipe
       WriteOutput(myChangeDelims & "  ");
       myAnotherList="a,b|c|d,e|f";
       myCustomDelims=ListChangeDelims(myAnotherList,"@","|"); //Replace occurrence of "|" with "@"
       WriteOutput(myCustomDelims);
</cfscript>

Output

a|b|c|d|e a,b@c@d,e@f

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy