summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2017-11-08 16:02:05 +0100
committerErich Eckner <git@eckner.net>2017-11-08 16:02:50 +0100
commit41755197f5f9f3f62e66460fe7fab5dd60662612 (patch)
tree1fc5cfaba57ff3275318deb8766a0bc3792555fb
parent967b3065663ab5c8d0ab98c87915bc712c3e0e5c (diff)
downloadunits-41755197f5f9f3f62e66460fe7fab5dd60662612.tar.xz
mystringlistunit.pas: grep kann nun auch invers
-rw-r--r--mystringlistunit.pas6
1 files changed, 3 insertions, 3 deletions
diff --git a/mystringlistunit.pas b/mystringlistunit.pas
index a5e1139..7aec8ee 100644
--- a/mystringlistunit.pas
+++ b/mystringlistunit.pas
@@ -26,7 +26,7 @@ type
function readln(out s: string): boolean; inline;
function metaReadln(out s: string; subRoutine: boolean): boolean; inline;
procedure grep(expr: string; invert: boolean = false);
- function grepFirst(expr: string): string;
+ function grepFirst(expr: string; invert: boolean = false): string;
procedure replace(von,nach: string);
procedure uniq(c: char);
procedure append(sl: tMyStringList); overload;
@@ -215,7 +215,7 @@ begin
tl.free;
end;
-function tMyStringList.grepFirst(expr: string): string;
+function tMyStringList.grepFirst(expr: string; invert: boolean = false): string;
var
re: tRegExpr;
i: longint;
@@ -223,7 +223,7 @@ begin
re:=tRegExpr.create;
re.expression:=expr;
for i:=count-1 downto 0 do
- if re.exec(self[i]) then begin
+ if invert xor re.exec(self[i]) then begin
result:=self[i];
re.free;
exit;