From 41755197f5f9f3f62e66460fe7fab5dd60662612 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Wed, 8 Nov 2017 16:02:05 +0100 Subject: mystringlistunit.pas: grep kann nun auch invers --- mystringlistunit.pas | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'mystringlistunit.pas') 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; -- cgit v1.2.3-70-g09d2