1

Possible Duplicate:
in c#: expression evaluation function like flash script

I need to calculate an arithmetic expression stored in a string.

The expression contains variables, but these I could replace in advance.

I'd use the JScript eval function, but it is deprecated and it does not honor the current locale set for the program (being in germany my expression is e.g. "4,28*1,10" instead of "4.28*1.10").

It needs to support localization and parantheses.

Community
  • 1
  • 1
Sam
  • 28,421
  • 49
  • 167
  • 247
  • I'm not posting this as an answer because it's a lot of work, but I think your best bet is to write an arithmetic parser. A [Pratt parser](http://journal.stuffwithstuff.com/2011/03/19/pratt-parsers-expression-parsing-made-easy/) would be pretty good for this job. – zneak Jul 11 '11 at 14:09
  • There are a few expression evaluators in .net (JScript, Ironpython, DataTable), is there none which can work with localisation?? – Sam Jul 11 '11 at 14:25

0 Answers0