Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!SOPHIST.UCHICAGO.EDU!goer From: goer@SOPHIST.UCHICAGO.EDU (Richard Goerwitz) Newsgroups: comp.lang.icon Subject: patch; using string scanning Message-ID: <9003150026.AA03952@sophist.uchicago.edu> Date: 15 Mar 90 00:26:35 GMT Sender: daemon@ucbvax.BERKELEY.EDU Distribution: inet Organization: The Internet Lines: 24 I liked the previous posting, and I don't think there was anything wrong with it. String scanning just seems a bit clearer to me than the i/j stuff. This is how I would have done it: procedure patch(var,mask) text := "" var ? { every chr := !mask do { case chr of { "#" : text ||:= move(1) "$" : move(1) default : text ||:= chr } } } return text end Warning, warning: This code fragment has not been tested (though with Icon it's pretty hard to screw up something of this sort). -Richard L. Goerwitz goer%sophist@uchicago.bitnet goer@sophist.uchicago.edu rutgers!oddjob!gide!sophist!goer