diff options
author | Erich Eckner <git@eckner.net> | 2016-05-20 10:19:48 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2016-05-20 10:19:48 +0200 |
commit | 6127ae1152c7f7961b6fbfd80dc8c37db55e55c3 (patch) | |
tree | a1a70cf98f71763c6d890e849151e0a41fa6f949 | |
parent | b9a096c4c5b374715ca093bfb27c0d724c110f45 (diff) | |
download | units-6127ae1152c7f7961b6fbfd80dc8c37db55e55c3.tar.xz |
grep in mystrinlistunit.pas kann nun auch invertiert
-rw-r--r-- | mystringlistunit.pas | 6 |
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; |