> My best guess is if you remove one item it changes the
> structure of the array and when it goes to remove the next
> one it cannot be found?
Yes.
<!--- does not work --->
<cfset myArray = [ "a", "b", "c", "d" ] />
<cfoutput>
<cfloop from="1" to="#arrayLen(myArray)#" index="i">
delete element [#i#] array size = #arrayLen(myArray)#<br />
<cfset arrayDeleteAt(myArray, i) />
</cfloop>
</cfoutput>
When deleting within a loop, iterate in _descending_ order.
<cfset myArray = [ "a", "b", "c", "d" ] />
<cfoutput>
<cfloop from="#arrayLen(myArray)#" to="1" index="i" step="-1">
delete element [#i#] array size = #arrayLen(myArray)#<br />
<cfset arrayDeleteAt(myArray, i) />
</cfloop>
</cfoutput>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know
on the House of Fusion mailing lists
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:329602
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4