String calculator [closed]

Regular Expression evaluation can be done using DataTable.Compute method (from MSDN) :

Computes the given expression on the current rows that pass the filter
criteria.

Try this:

using System.Data;//import this namespace

 string math = "100 * 5 - 2";
 string value = new DataTable().Compute(math, null).ToString();

Leave a Comment