listQualify

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

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

listQualify 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: ,

elements string
Default: all

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


Fork me on GitHub