listQualify

Inserts a string at the beginning and end of list elements.

listQualify(list, qualifier [, delimiters] [, elements] [, includeEmptyValues]) → returns string

Argument Reference

list string
Required

A list or variable name

qualifier string
Required

A string or character in which to insert before and after the list elements

delimiters string
Default: ,

Characters that separate list elements. The default value is comma. If this parameter contains more than one character, ColdFusion uses the first character as the delimiter and ignores the remaining characters.

elements string
Default: all

all -all elements; char -elements that are composed of alphabetic characters
Values:
  • all
  • char

includeEmptyFields boolean

If includeEmptyFields is true, empty value add in list elements
Values:
  • true
  • false

Examples
Sample code invoking the listQualify function

To insert a string or character before and after the list elements.

list = "coldfusion:railo:144:lucee:46";
writeOutput(listQualify(list, "|", ":"));

Expected Result: |coldfusion|:|railo|:|144|:|lucee|:|46|

To insert a string or character before and after the alphabet list elements only.

list = "coldfusion:railo:144:lucee:46";
writeOutput(listQualify(list, "|", ":","CHAR"));

Expected Result: |coldfusion|:|railo|:144:|lucee|:46

If includeEmptyFields is true, empty value add in list elements.

list = "coldfusion:railo:144::lucee::46";
writeOutput(listQualify(list, "|", ":","CHAR",true));

Expected Result: |coldfusion|:|railo|:144:||:|lucee|:||:46

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

Fork me on GitHub