At 8:38 AM -0500 1/9/02, Ivers, Doug E wrote: >Thanks, Geoff! The speed of "repeat for each char..." is a valuable >revelation for me! With this new understanding, what would be the most >efficient code for a >"stripChars(theText,theChars)" function? Normally, I would say "repeat with >i = number of chars of theText down to 1" so that I can delete chars with >out messing up the indexing. Is there a similar way to reverse the "repeat >for each..."? If not, should I pull out the chars I want and assemble a new >return string?
Exactly: put empty into tResult repeat for each char C in tMyString if C is in tMyListOfAcceptableChars then put C after tResult end if end repeat --tResult is now the string you want. The repeat with i =... form will be much slower for large strings, and will get slower geometrically. The repeat for each form gets slower linearly. (both assessments are rough estimates) regards, Geoff _______________________________________________ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution
