listQualify

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

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

listQualify Argument Reference

list
Required

A list or variable name

qualifier
Required

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

delimiters
Default: ,

Values:
  • ,
  • |
  • ;
  • chr(9)
  • chr(10)
  • chr(13)

elements
Default: all

Values:
  • all
  • char

includeEmptyFields

If includeEmptyFields is true, empty value add in list elements

Examples sample code invoking the listQualify function


Simple example for listQualify function with delimiter

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|


Example for listQualify function with elements

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


Example for listQualify function with includeEmptyFields

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