summaryrefslogtreecommitdiff
path: root/matheunit.pas
diff options
context:
space:
mode:
Diffstat (limited to 'matheunit.pas')
-rw-r--r--matheunit.pas17
1 files changed, 16 insertions, 1 deletions
diff --git a/matheunit.pas b/matheunit.pas
index 61c1eea..7b00e52 100644
--- a/matheunit.pas
+++ b/matheunit.pas
@@ -468,6 +468,21 @@ begin
floattostr(exprtofloat(st,copy(s,pos('(',s)+1,i-pos('(',s)-1),kvs,cbgv))+
copy(s,i+1,length(s)-i);
end;
+
+ if assigned(cbgv) then
+ while pos('[',s)>0 do begin
+ i:=pos('[',s)-1; // i wird Index des letzten Zeichens vor "Werte[bla].blubb" o. ä.
+ while (i>0) and not (s[i] in ['+','-','*','/','^']) do
+ dec(i);
+ j:=pos(']',s)+1; // j wird Index des ersten Zeichens nach "Werte[bla].blubb" o. ä.
+ while (j<=length(s)) and not (s[j] in ['+','-','*','/','^']) do
+ inc(j);
+
+ s:=copy(s,1,i)+ // vorher
+ floattostr(cbgv(copy(s,i+1,j-i-1)))+ // zwischen
+ copy(s,j,length(s)-j+1); // nachher
+ end;
+
if (binOpPos('+',s)>0) or (binOpPos('-',s)>0) then begin
result:=0;
inv:=false;
@@ -507,7 +522,7 @@ begin
for i:=1 to length(s) do
cbv:=cbv or not (s[i] in ['-','0'..'9','.',',','e','E']);
if not cbv then result:=strtofloat(s)
- else if not kvs.extract(s,result) then begin
+ else if not (assigned(kvs) and kvs.extract(s,result)) then begin
if st then result:=1
else if assigned(cbgv) then result:=cbgv(s)
else begin