Tony, if someone entered a 0, wouldnt you want to account for that? Or if you didnt.. why not delete the 0's and then get an average (if they're just place holders)? If a 0 is just a place holder, you wouldnt want to replace it with a previous value. That would mess up your average.
On Wed, 16 Feb 2005 10:32:28 -0500, Ben Doom <[EMAIL PROTECTED]> wrote: > S.Isaac pointed out that I'd misread the original post. I thought he > wanted to remove them, not replace them. That makes this just a wee bit > harder. :-) > > Since what he's wanting to do is apparently average them, I'd write the > summation loop manually and track the last non-zero value to use in case > of zeros. I'm not sure what he'd want to do with a leading zero, but > that's a whole new bag'o'worms. > > --Ben > > Michael Dinowitz wrote: > > Ben, > > I've tried this a few ways and I can't find any way to do a single run RegEx > > which will do the job. Handling a single 0 is child's play. Handling > > multiple properly is not happening. > > If this was put in a loop, I can see it but..... > > What do you suggest as a solution that will handle multiple 0 replaces > > without a loop? > > > > > >>Well, you could use listdeleteat() to remove them. That would probably > >>be more human readable later. It would also handle boundary cases (ie > >>the first and last items) easily and cleanly. > >> > >>If, for some reason, you really want to use a regex, it certainly can be > >>done. :-) > >> > >>--Ben > >> > >>Tony Hicks wrote: > >> > >>>Does anyone know if there's a way to replace an unkown number of > >>>consequitive 0s in a list with the previous number.. > >>> > >>>For instance... > >>> > >>>147,0,119,137,0,0,0,154 would become.. > >>> > >>>147,147,119,137,137,137,137,154 > >>> > >>>Thanks > >>>Tony > >>> > >>> > >> > >> > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:194974 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54