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

listChangeDelims Argument Reference

list
Required

A list or a variable that contains one.

new_delimiter
Required

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

delimiters
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. Values:
  • ,
  • |
  • ;
  • chr(9)
  • chr(10)
  • chr(13)

includeEmptyValues
Default: NO

CF 10+ Set to yes to include empty values.

Examples sample code invoking the listChangeDelims function


Simple Example

Changes the delimiters in the list

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

Expected Result: foo|bar|lorem|ipsum


Example with Custom Delimiter

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


Fork me on GitHub