Following string in my input
"(((5292-5325)-(5401/5))/5325)"
I need to calculate this one and wants to get output in float
. For that I used string
to float
conversion but I got exception. how to do that one?
Following string in my input
"(((5292-5325)-(5401/5))/5325)"
I need to calculate this one and wants to get output in float
. For that I used string
to float
conversion but I got exception. how to do that one?
I use a DataTable
for this purpose usually:
DataTable dt = new DataTable();
var result = dt.Compute("(((5292-5325)-(5401/5))/5325)", "");
Or:
double result = (double)dt.Compute("(((5292-5325)-(5401/5))/5325)", "");
Can quickly think of 2 ways: