| CFML Reference
|
|
ColdFusion Functions
|
ListDeleteAt
Description
Returns list with element deleted at the specified position.
Category
List functions
Syntax
ListDeleteAt(list, position [, delimiters ])
See also
ListGetAt, ListSetAt, ListLen.
Parameters
| Parameter |
Description |
list
|
A list.
|
position
|
Positive integer that indicates the position of the element to delete. The starting position in a list is denoted by the number 1, not 0.
|
delimiters
|
Set of delimiters used in list
|
Usage
ColdFusion ignores empty list elements; thus, a list that is defined as "a,b,c,,,d" is treated as a four element list.
Example <!--- 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>
|
Copyright © 2001, Macromedia Inc. All rights reserved. |
|
|