ListQualify

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

Method Signature

ListQualify(list=[string], qualifier=[string], delimiter=[string], elements=[string], includeEmptyFields=[boolean])

Arguments

Argument
Type
Required
Description
Default

list

string

true

The list to qualify.

qualifier

string

true

The string to insert at the beginning and end of each element.

delimiter

string

false

The delimiter used in the list.

,

elements

string

false

The elements to qualify. If set to "char", only elements that are all alphabetic characters will be qualified.

all

includeEmptyFields

boolean

false

If true, empty fields will be qualified.

false

Examples

Simple example for listQualify function with delimiter

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

Run Example

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

Result: |boxlang|:|railo|:|144|:|boxlang|:|46|

Example for listQualify function with elements

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

Run Example

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

Result: |boxlang|:|railo|:144:|boxlang|:46

Example for listQualify function with includeEmptyFields

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

Run Example

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

Result: |boxlang|:|railo|:144:||:|boxlang|:||:46

Additional Examples

Run Example

// Simple function with different delimiter(/)
writeOutput( listQualify( "string/Boxlang/susi/LAS", "^", "/" ) & "<br><br>" );
// Member function
strList = "Boxlang,Boxlang,LAS,SUSI";
writeDump( strlist.listQualify( "|" ) );

Last updated

Was this helpful?