Re: String Search and Replace

new topic     » goto parent     » topic index » view thread      » older message » newer message

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

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu