summaryrefslogtreecommitdiff
path: root/matheunit.pas
diff options
context:
space:
mode:
Diffstat (limited to 'matheunit.pas')
-rw-r--r--matheunit.pas17
1 files changed, 17 insertions, 0 deletions
diff --git a/matheunit.pas b/matheunit.pas
index dd4b4bc..cf7eda8 100644
--- a/matheunit.pas
+++ b/matheunit.pas
@@ -23,6 +23,7 @@ type
destructor destroy; override;
procedure add(val: tKnownValue); inline; overload;
procedure add(nam: string; val: extended); overload;
+ function rem(nam: string): boolean;
function extract(nam: string; out val: extended): boolean; inline;
end;
@@ -90,6 +91,22 @@ begin
kvs[i].value:=val;
end;
+function tKnownValues.rem(nam: string): boolean;
+var
+ i: longint;
+begin
+ i:=finde(nam);
+ result:=i>=0;
+ if result then begin
+ while i<length(kvs)-1 do begin
+ kvs[i].name:=kvs[i+1].name;
+ kvs[i].value:=kvs[i+1].value;
+ inc(i);
+ end;
+ setlength(kvs,length(kvs)-1);
+ end;
+end;
+
function tKnownValues.extract(nam: string; out val: extended): boolean;
var
i: longint;