VB.Net- Evaluating Mathematical Expression in a String

Is there a method that allows me to evaluate a mathematical expression in a string? Example (Not actual Code):

Input = "2+2"

Output = SomeMethod(Input)

Output = 4

Update: Nevermind, I found a way around it by using DataTable.Compute.

Answers


You'll need a math expression parser to handle this.

Here are some various open source options on CodePlex:

A search will find many others...


Need Your Help

Formula to return the sum of a range in Excel for certain rows in a different column

excel sum formula

I would like to use formula to return the sum of cells from column B where cell value in column A is equal to a certain week number. The table is below. For example if Week = 1 the SUM would be 40;...