Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread StringReplace
Tue, Jul 10 2007 10:19 AMPermanent Link

Thor Warberg
This is compling, but does not work:

AssignFile(F, path);

While not Eof (F) do
begin
ReadLn(F, s);
StringReplace(s, "A", "AB", (rfReplaceAll));
next;
end;

Why is there no replace?
Thor Warberg
Norway
(It seems rather quiet in Borland newsgroups, - due to summer time?)
Tue, Jul 10 2007 11:52 AMPermanent Link

Dave Harrison
Thor Warberg wrote:

> (It seems rather quiet in Borland newsgroups, - due to summer time?)

You do know that this is the DBISAM newsgroup and not Borland's, right?

> This is compling, but does not work:
>
> AssignFile(F, path);
>
> While not Eof (F) do
> begin
> ReadLn(F, s);
> StringReplace(s, "A", "AB", (rfReplaceAll));
> next;
> end;
>
> Why is there no replace?

StringReplace is a function. You forgot to assign it back to the
variable "s".

s := StringReplace(s, "A", "AB", (rfReplaceAll));

Dave
Tue, Jul 10 2007 11:58 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Thor,

<< StringReplace(s, "A", "AB", (rfReplaceAll));  >>

This should be:

StringReplace(s, "A", "AB", [rfReplaceAll]);

--
Tim Young
Elevate Software
www.elevatesoft.com

Image