Re: TIdSysVCL.StringReplace buglet

Giganews Newsgroups
Subject: Re: TIdSysVCL.StringReplace buglet
Posted by:  Ben Taylor [Team Indy] (to_b…@yahoo.com)
Date: Wed, 18 May 2005

Hi,

thanks, now fixed :-)

Tim Parker-Nance wrote:
> The version that takes an array has a buglet/feature. The current code is as
> follows:
>
>  for i := Low(OldPattern) to High(OldPattern) do
>  begin
>    Result :=
> SysUtils.StringReplace(s,OldPattern[i],NewPattern[i],[rfReplaceAll]);
>  end;
>
> The problem is that the result is the last SysUtils.StringReplace. It is not
> the accumulation of the n StringReplaces. What it should be is as follows:
>
>  Result := s;
>  for i := Low(OldPattern) to High(OldPattern) do
>  begin
>    Result :=
> SysUtils.StringReplace(Result,OldPattern[i],NewPattern[i],[rfReplaceAll]);
>  end;

Replies

None

In response to

TIdSysVCL.StringReplace buglet posted by Tim Parker-Nance on Wed, 18 May 2005