listChangeDelims

Changes a list delimiter.
Returns a copy of the list, with each delimiter character
replaced by new_delimiter.

listChangeDelims(list, new_delimiter [, delimiters, [includeEmptyValues]]) → returns string

Member Function Syntax

list.listChangeDelims(new_delimiter [, delimiters, [includeEmptyValues]])

Argument Reference

list string
Required

A list or a variable that contains one.

new_delimiter string
Required

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

delimiters string
Default: ,

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.

includeEmptyValues string
Default: NO

CF 10+ Set to yes to include empty values.

Examples
Sample code invoking the listChangeDelims function

Changes the delimiters in the list

listChangeDelims("foo,bar,lorem,ipsum", "|")

Expected Result: foo|bar|lorem|ipsum

Changes the delimiters in the list using a custom delimiter

listChangeDelims("foo,bar|lorem,ipsum|me|something", "~", "|")

Expected Result: foo,bar~lorem,ipsum~me~something

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub