Returns a list with a qualifying character around each item in the list, such as double or single quotes.
See the List Functions table.
ListQualify(list, qualifier [, delimiters ] [, elements ])
Any list of items or a variable that names a list.
The character that is to be placed at the beginning and end of each item in the list.
Set of delimiters used in list.
Either the keyword "ALL" or "CHAR." If you specify "ALL," the function qualifies all items in the list. If you specify "CHAR," the function qualifiers only items comprised of alphabetic characters; it does not qualify numeric items.
The new list may not preserve all of the delimiters in the previous list.
<!--- This example uses ListQualify to put quotes around each employees full name ---> <HTML> <HEAD> <TITLE>ListQualify Example</TITLE> </HEAD> <body bgcolor="#FFFFD5"> <CFQUERY NAME="GetEmployeeNames" DATASOURCE="cfsnippets"> SELECT FirstName, LastName FROM Employees </CFQUERY> <H3>ListQualify Example</H3> <P>This example uses ListQualify to place the full names of the employees found in the query within quotation marks.</P> <CFSET myArray = ArrayNew(1)> <!--- loop through the query and append these names successively to the last element ---> <CFLOOP query="GetEmployeeNames"> <CFSET temp= ArrayAppend(myArray, "#FirstName# #LastName#")> </CFLOOP> <!--- sort that array descending alphabetically ---> <CFSET myAlphaArray = ArraySort(myArray, "textnocase")> <!--- show the resulting array as a list ---> <CFSET myList=ArrayToList(myArray, ",")> <CFOUTPUT> <P>The contents of the unqualified list are as follows: </P> #myList# </CFOUTPUT> <!--- show the resulting alphabetized array as a qualified list with single quotes around each full name. ---> <CFSET qualifiedList1=ListQualify(myList,"'",",","CHAR")> <!--- output the array as a list ---> <CFOUTPUT> <P>The contents of the qualified list are as follows: </P> <P>#qualifiedList1#</P> </CFOUTPUT> <!--- show the resulting alphabetized array as a qualified list with quotation marks around each full name. Note that we use " to denote quotation marks because the quotation mark character is a control character. ---> <CFSET qualifiedList2=ListQualify(myList,""",",","CHAR")> <!--- output the array as a list ---> <CFOUTPUT> <P>The contents of the second qualified list are as follows: </P> <P>#qualifiedList2#</P> </CFOUTPUT> </BODY> </HTML>