summaryrefslogtreecommitdiff
path: root/mystringlistunit.pas
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2016-05-20 10:19:48 +0200
committerErich Eckner <git@eckner.net>2016-05-20 10:19:48 +0200
commit6127ae1152c7f7961b6fbfd80dc8c37db55e55c3 (patch)
treea1a70cf98f71763c6d890e849151e0a41fa6f949 /mystringlistunit.pas
parentb9a096c4c5b374715ca093bfb27c0d724c110f45 (diff)
downloadunits-6127ae1152c7f7961b6fbfd80dc8c37db55e55c3.tar.xz
grep in mystrinlistunit.pas kann nun auch invertiert
Diffstat (limited to 'mystringlistunit.pas')
-rw-r--r--mystringlistunit.pas6
1 files changed, 3 insertions, 3 deletions
diff --git a/mystringlistunit.pas b/mystringlistunit.pas
index af03f4a..31f9af5 100644
--- a/mystringlistunit.pas
+++ b/mystringlistunit.pas
@@ -25,7 +25,7 @@ type
procedure saveToGz(const s: ansiString);
function readln(out s: string): boolean; inline;
function metaReadln(out s: string; subRoutine: boolean): boolean; inline;
- procedure grep(expr: string);
+ procedure grep(expr: string; invert: boolean = false);
function grepFirst(expr: string): string;
function hatZeile(zeile: string): boolean; // invers zu "grep -c"
function eof: boolean;
@@ -185,7 +185,7 @@ begin
result:=readln(s);
end;
-procedure tMyStringlist.grep(expr: string);
+procedure tMyStringlist.grep(expr: string; invert: boolean);
var
re: tRegExpr;
i: longint;
@@ -193,7 +193,7 @@ begin
re:=tRegExpr.create;
re.expression:=expr;
for i:=count-1 downto 0 do
- if not re.exec(self[i]) then
+ if not invert xor re.exec(self[i]) then
delete(i);
re.free;
end;