You've already forked lazarus-ccr
RxFPC:rxstrutils add new function - FileToString
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6914 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
components/rx/trunk
@ -232,7 +232,7 @@ function RomanToInt(const S: string): Longint; deprecated; //use this function f
|
||||
doesn't contain a valid roman numeric value, the 0 value is returned. }
|
||||
|
||||
procedure StrToStrings(const S:string; const List:TStrings; const Delims:Char);
|
||||
|
||||
function FileToString(const AFileName:string):string;
|
||||
const
|
||||
DigitChars = ['0'..'9'];
|
||||
Brackets = ['(',')','[',']','{','}'];
|
||||
@ -1129,4 +1129,24 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function FileToString(const AFileName: string): string;
|
||||
var
|
||||
F: TFileStream;
|
||||
begin
|
||||
if FileExists(AFileName) then
|
||||
begin;
|
||||
F:=TFileStream.Create(AFileName, fmOpenRead);
|
||||
if F.Size>0 then
|
||||
begin
|
||||
SetLength(Result, F.Size);
|
||||
F.ReadBuffer(Result[1], F.Size);
|
||||
end
|
||||
else
|
||||
Result:='';
|
||||
F.Free;
|
||||
end
|
||||
else
|
||||
Result:='';
|
||||
end;
|
||||
|
||||
end.
|
||||
|
Reference in New Issue
Block a user