3

Say I have a string like "(12.2*(5/7))", is there an API/method that can parse this or would I need to write one from scratch?

Thanks

3 Answers 3

3

Yes, there are such frameworks. Just google for '.NET expression parser' and you get plenty of results!

Sign up to request clarification or add additional context in comments.

Comments

0

You'd need to write one or find a library to do this. There is nothing built into .NET to support this as standard.

One thing I've found myself considering when looking at problems like this is an Excel library (we already use one called FlexCel) which will handle all the standard Excel syntax and provide a rich suite of functions. You just end up excluding the excel specific ranges. The nice thing about this, is almost everyone knows how to use Excel functions already.

Comments

0

See the CodeProject.com article Implementing Programming Language Tools in C#. Included samples include an arithmetic evaluator and a JavaScript to expression tree compiler. Combining these should provide you with what you want.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.