I found my own answer if no one else has one. I use a Datatable to do the
computation for me:
Sub Main()
Dim B As Boolean = False
B = CBool(Compute("7=7", B.GetType))
Dim N As Decimal = 0
N = CDec(Compute("8+3.4", N.GetType))
Dim S As String = String.Empty
S = CStr(Compute("'Me ' + 'You'", S.GetType))
MsgBox(B.ToString + vbCrLf + N.ToString + vbCrLf + S)
End Sub
Private Function Compute(ByVal S As String, ByVal ResultType As Type) As
Object
Dim DT As New DataTable
DT.Columns.Add(New DataColumn("A", ResultType))
DT.Rows.Add(DT.NewRow)
DT.Columns("A").Expression = S
Return DT.Rows(0)("A")
End Function
--
--Zorpie
"Zorpiedoman" wrote:
If I have a string, "(5+3)/8" or "23>9"
Has .NET provides some sort of parser that can get me the mathematical answer?
Years ago, in VB6 I found an answer to this question using some sort of
web-based object. It's been so long, I forget even what it was.
--
--Zorpie