public static double Evaluate ( string expression )
{
// That is some code instruction, is'nt it? :)
return (double) new System.Xml.XPath.XPathDocument
( new StringReader("
( string.Format("number({0})", new
System.Text.RegularExpressions.Regex(@"([\+\-\*])")
.Replace(expression, " ${1} ")
.Replace("/", " div ")
.Replace("%", " mod ") ) );
}
Minggu, 02 Agustus 2009
Evaluate string expression C#
Diposting oleh Vampire Site di 22.19
Label: .NET, C#, MS Visual Studio .NET, Programming
Langganan:
Posting Komentar
(Atom)
0 komentar:
Posting Komentar