ArrayDeleteAtList(a, l)
Last updated January 21, 2005
Version: 1 | Requires: ColdFusion 5 | Library: DataManipulationLib
Description:
Deletes elements from an array passing the list of positions.
Similar to ArrayDeleteAt but the position value could be a list of positions.
Return Values:
Returns an array.
Example:
<cfset myArr[1]="1st">
<cfset myArr[2]="2nd">
<cfset myArr[3]="3rd">
<cfset myArr[4]="4th">
<cfset myArr[5]="5th">
<cfdump var="#myArr#" label="Original array">
<cfset list='1,5'>
To delete: <br />
<cfoutput>#list#</cfoutput><br />
<cfdump var="#ArrayDeleteAtList(myArr,list)#" label="parsedArray">
Parameters:
| Name | Description | Required |
|---|---|---|
| a | The array to modify. | Yes |
| l | The list of indexes to remove. | Yes |
Full UDF Source:
<cfscript>
/**
* Deletes an elements list from an array.
*
* @param a The array to modify. (Required)
* @param l The list of indexes to remove. (Required)
* @return Returns an array.
* @author Giampaolo Bellavite (giampaolo@bellavite.com)
* @version 1, January 21, 2005
*/
function ArrayDeleteAtList(a,l) {
var i=1;
l = listSort(l, "numeric", "desc");
for(i=1; i lte listLen(l); i=i+1) arrayDeleteAt(a, listGetAt(l,i));
return a;
}
</cfscript>
Search CFLib.org
Latest Additions
Jose Diaz-Salcedo added
cfRssFeed
2 day(s) ago
Raymond Compton added
structBlend
23 day(s) ago
Duncan added
IsZIPUK
23 day(s) ago
Todd Sharp added
getTagContentAll
29 day(s) ago
Gerald Guido added
ListReturnDuplicat...
1 month(s) ago