πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.web
Article #1037

Re: How to replace text in a file

#1037
From: RS
Date: Wed, 14 Sep 2005 18:04
38 lines
1773 bytes
OK !!

Many Thanks

"Hans Galema" <notused@notused.nl> a οΏ½crit dans le message de news: 
431c228c$1@newsgroups.borland.com...
> RS wrote:
>
>> How to replace text in a .txt file ?
>> for example :
>> this is my "myfile.txt" :
>>
>> Hello "Jack",
>>
>> i would like replace the word Jack by John
>>
>> Hello "John"
>
> Your problem has little to do with 'web'.
>
>
> Replace "Jack" by "John":
>
>   AnsiString FileName = "mytext.txt";
>
>   TStringList *StringList = new TStringList;
>
>   StringList->LoadFromFile ( FileName );
>
>   StringList->Text = StringReplace ( StringList->Text
>      , "\"Jack\"", "\"John\""
>      , TReplaceFlags() << rfReplaceAll );
>
>   StringList->SaveToFile ( FileName );
>
>   delete StringList;
>
> Hans. 
Technical Details
Message-ID: <43286510@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!newsfeed.hal-mli.net!feeder1.hal-mli.net!news-out.newsfeeds.com!propagator3-LAX.newsfeeds.com!news-in.spamkiller.net!news-in.superfeed.net!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <431ad5a0@newsgroups.borland.com> <431c228c$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: feeec,214f73fbc3dc2fa6
X-Google-Attributes: gidfeeec,public
X-Google-Language: ENGLISH,ASCII
From: "RS" <rs.reloaded@wanadoo.fr>
Newsgroups: borland.public.cppbuilder.internet.web
References: <431ad5a0@newsgroups.borland.com> <431c228c$1@newsgroups.borland.com>
Subject: Re: How to replace text in a file
Date: Wed, 14 Sep 2005 20:04:15 +0200
Lines: 40
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
X-RFC2646: Format=Flowed; Response
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
NNTP-Posting-Host: 83.194.69.9
Message-ID: <43286510@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1126720784 83.194.69.9 (14 Sep 2005 10:59:44 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!newsfeed.hal-mli.net!feeder1.hal-mli.net!news-out.newsfeeds.com!propagator3-LAX.newsfeeds.com!news-in.spamkiller.net!news-in.superfeed.net!caladan.landsraad.net!newsgroups.borland.com!not-for-mail