The eval() function evaluates the string expression and returns its value.
For example, eval("10 + 1 - 2") returns 9.
this sounds like you want to implement some kind of calculator based on a string input.
In general, there are two aspects: parsing the string and doing the math. In order to give you some helpful hints (instead of implementing that for you), it would be helpful to know, what you have done so far and what is missing.
Maybe the following links help you:
Data type string and the different instant methods
I hope this helps.
Hello,if you want to make a calculator, why do you want to work with strings? The calculator itself is more or less (depending on the feature set) straight forward - but the usage of strings makes it more inconvenient.Let's assume you have a GUI application with a couple of buttons for numbers ('0'...'9') and some buttons for operators ('+', '-', '/', '*', ...). In the buttons OnActivate handler you process the inputs:
Does that help? Of course, the above is just a rough sketch and not a complete calculator...Best regards,Manfred.
Ask Embedded Wizard
Welcome to the question and answer site for Embedded Wizard users and UI developers.
Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!