function Calc(s: string): string; var vScript: Variant; begin vScript := CreateOleObject('ScriptControl'); vScript.Language := 'VBScript'; Result := vScript.Eval(s); end; //调用 var s:string; begin s:=Calc('10*2/5-0.32+5*2/3.15*[(6+5)-3/5]'); ShowMessage(s); end;