Re: String Search and Replace
- Posted by Brian Broker <bkb at CNW.COM> Nov 16, 1999
- 479 views
On Tue, 16 Nov 1999 11:53:06 -0500, Brian Broker <bkb at CNW.COM> wrote: Just a side note, I noticed I changed my solution a bit (besides changing variable names): > ... > while loc do > return target[1..(loc - 1) ] & > new & > -- recursive call on remainder of string -- > replace( target[(loc + len)..length( target )], old, new ) > end while > > return target > ... It doesn't change the behavior but the above might be easier to follow when written like: if loc then return target[1..(loc - 1) ] & new & -- recursive call on remainder of string -- replace( target[(loc + len)..length( target )], old, new ) else return target end if