如果仅仅是
“y = 6E-07x6 - 3E-05x5 + 0.0003x4 + 0.0038x3 - 0.079x2 + 0.4173x - 0.2306”
那好办,给你以下函数.
function Replace(str,s1,s2:string;casesensitive:boolean=False):string;
var
i:integer;
s,t:string;
begin
s:='';
t:=str;
try
repeat
if casesensitive then i:=pos(s1,t) else i:=pos(lowercase(s1),lowercase(t));
if i>0 then
begin
s:=s+Copy(t,1,i-1)+s2;
t:=Copy(t,i+Length(s1),MaxInt);
end
else s:=s+t;
until i<=0;
result:=s;
except
result:='';
// application.MessageBox('1','555');
end;
end;
function Calculate(express:string):string;
var
vscript:variant;
begin
try
vscript:=createoleobject('scriptcontrol');
vscript.language:='javascript';
result:=vscript.eval(express);
except
result:='';
// application.MessageBox('表达式出错!','提示');
end;
end;