Delphi表达式

function ExpCalc(exp: string): string; var vScript: Variant; begin vScript := CreateOleObject('ScriptControl'); vScript.Language := 'VBScript'; Result := vScript.Eval(exp); end; procedure TForm1.Button1Click(Sender: TObject); var s:string; begin s:=ExpCalc('100 *4.17/0.5*(55.22+22)/3.14'); ShowMessage(s); end;

 

 

你可能感兴趣的:(function,String,VBScript,Delphi)