2
我使用Mathos Math parser來評估數學表達式。我試圖解析下面的表達式,但它拋出出現FormatException - 輸入字符串的不正確的格式..無法使用Mathos Math Prser評估數學表達式
Mathos.Parser.MathParser parser = new Mathos.Parser.MathParser();
string expression = "Math.pow((4),(5))"; //Or "Math.sqrt(1)";
string result = parser.Parse(expression).ToString();
在我的應用我使用MathDox MATHML編輯器,這給了我MATHML。使用這個mathml,我將它解析爲使用javascript的普通數學表達式,如給定here,然後將此表達式發送到我的c#代碼進行評估。 我的表情有什麼問題。
注:由於某些條件,我不評估JavaScript中的數學表達式。
一個解決方案我喜歡是使用使用Microsoft JScript中的,而不是Mathos在C#中的javascript的eval。 http://odetocode.com/articles/80.aspx但它也在某些情況下失敗 – 2014-10-28 13:22:47
你能否請檢查我的解決方案是否工作! – Artem 2014-11-30 17:54:11