Hi friends ,
I have a string like : "10*2"
now, i want to return the result as a float for that string expression : 20 = (10*2)
how can i do it , thanks .
Convert from a string of expression into a float result in C#
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Syed ShakeerRank #777 · 3K reputationPosted Jul 13, 2010, 11:45 PM EDT
String str="10*2";
string [] spl=str.Split(*);
float a=Convert.ToFloat(spl[0]);
float b=Convert.ToFloat(spl[1]);
float result=a * b;
Minh40 reputationPosted Jul 14, 2010, 12:05 AM EDT
I have a complex string with equators like +,-,*,/ and others like "(",")" in an expression .
For example : (10*2)+((8*6-9*5+3*2)*(72*7/2)) .
Hope for your help soon . it is urgent for me . Thanks much. ( Sorry if i give the very simple in the original question )
Minh40 reputationPosted Jul 18, 2010, 11:00 PM EDT
For example : you have a string : x= " (2*3+2*(2-8))"
and what you do is : y=&x (=-6 as the result from x) .
But i do not know what I should do in c#.net , it is very difficult .