diff options
author | Erich Eckner <git@eckner.net> | 2015-07-27 14:57:31 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2015-07-27 14:57:31 +0200 |
commit | c3a01b065a030a78471ee68e087055af3a49af69 (patch) | |
tree | 15abaab17a1307c4e1253f26b75db1670895af2c /matheunit.pas | |
parent | 31b1073b05e2759a09ba9cbb5f32c8e9a00cbd37 (diff) | |
download | units-c3a01b065a030a78471ee68e087055af3a49af69.tar.xz |
tKnownValues.rem in matheunit.pas eingefuegt
Diffstat (limited to 'matheunit.pas')
-rw-r--r-- | matheunit.pas | 17 |
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; |