Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trouble with CFLOOP and ArrayDeleteAt

Status
Not open for further replies.

khurram

IS-IT--Management
Jan 10, 2001
95
CA
I am having some trouble with an Index Loop and ArrayDeleteAt.

The index is to go from 1 to the length of the loop. However, when it encounters a 0, that record is deleted using ArrayDeleteAt. The problem is that when it does, the loop is going to exceed the array's length by at least 1.

Is there another way around this?

Thanks in advance.
 
don't use a counter to test if you're done, go the other way round (start from the end until there are elements remaining)
btw this is totally NOT a coldfusion problem
you'd better go to the "algorithm" or "coding" forum or something !!
 
If you are just removing the 0's from a list, you could use the Replace() function, like Replace(MyVar,"0","","all")

ColdFusion has many many functions and the more of them you are familiar with, the easier your job gets :)

Here is a decent list (not yet complete) with reasonable examples - sorted by "what they do"

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top