-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmodules.strings.pas
More file actions
43 lines (37 loc) · 935 Bytes
/
modules.strings.pas
File metadata and controls
43 lines (37 loc) · 935 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
unit modules.strings;
interface
function GetCode(const AFile, AName: string): string;
implementation
uses System.Classes, System.SysUtils;
function GetCode(const AFile, AName: string): string;
begin
var sl := TStringList.Create;
try
sl.LoadFromFile(AFile);
var LCnt := 0;
while LCnt < sl.Count do
begin
if not sl.Strings[LCnt].StartsWith(AName, True) then
begin
Inc(LCnt);
Continue;
end;
Result := Result + sl.Strings[LCnt] + sLineBreak;
break;
end;
var LEnd := Succ(LCnt);
while LEnd < sl.Count do
begin
// For clarity, ignore the lines which trigger this function..
if not sl.Strings[LEnd].Contains('LoadSyn', True) then
begin
Result := Result + sl.Strings[LEnd] + sLineBreak;
if sl.Strings[LEnd].StartsWith('end;', True) then break;
end;
Inc(LEnd);
end;
finally
sl.Free;
end;
end;
end.