Re: How to search for a specific string in a txt file (FindComponent?)
- From: "Maarten Wiltink" <maarten@xxxxxxxxxxxxxxxxxx>
- Date: Mon, 25 Apr 2005 21:48:02 +0200
<pjwolters@xxxxxxxxx> wrote in message
news:1114456563.484880.239940@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Can anyone tell me how to find a specific string in a txt file.
> I need to find this string and then change it into something else.
> I've tried using the FindComponent but no success.
I'm not surprised. FindComponent has exactly nothing to do with
searching text.
Type "Pos", press F1, read help.
Type "Delete", press F1, read more help.
Type "Insert", press F1, read yet more help.
Buy three, get one for free:
function LoadText(const Filename: String): String;
var Input: TStream;
begin
Input:=TFileStream.Create(Filename, fmOpenRead or fmShareDenyWrite);
try
SetLength(Result, Input.Size);
if (0<Length(Result))
then Input.ReadBuffer(Result[1], Length(Result));
finally
Input.Free;
end;
end;
Other implementations are possible.
Groetjes,
Maarten Wiltink
.
- References:
- Prev by Date: How to search for a specific string in a txt file (FindComponent?)
- Next by Date: Re: How to search for a specific string in a txt file (FindComponent?)
- Previous by thread: How to search for a specific string in a txt file (FindComponent?)
- Next by thread: Re: How to search for a specific string in a txt file (FindComponent?)
- Index(es):
Relevant Pages
|
|