User Guide
Chapter 2: ColdFusion Functions 413
ListDeleteAt
Returns list with element deleted at the specified position.
See also ListGetAt, ListSetAt, and ListLen.
Syntax ListDeleteAt(
list
,
position
[,
delimiters
])
list
Any list.
position
Positive integer indicating the position of the element being deleted. The starting
position in a list is denoted by the number 1, not 0.
delimiters
Set of delimiters used in list.
Examples <!--- This example shows ListDeleteAt --->
<HTML>
<HEAD>
<TITLE>ListDeleteAt Example</TITLE>
</HEAD>
<BODY>
<H3>ListDeleteAt Example</H3>
<!--- First, query to get some values for our list --->
<CFQUERY NAME="GetParkInfo" DATASOURCE="cfsnippets">
SELECT PARKNAME,CITY,STATE
FROM PARKS
WHERE PARKNAME LIKE ‘CH%’
</CFQUERY>
<CFSET temp = ValueList(GetParkInfo.ParkName)>
<CFSET deleted_item = ListGetAt(temp, "3", ",")>
<CFOUTPUT>
<P>The original list: #temp#
</CFOUTPUT>
<!--- now, delete the third item from the list --->
<CFSET temp2 = ListDeleteAt(Temp, "3", ",")>
<CFOUTPUT>
<P>The changed list: #temp2#
<BR><I>Note that <B>#deleted_item#</B> is not longer present
at position three of the list.</I>
</CFOUTPUT>
</BODY>
</HTML>