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:
- If a number button is pressed, the current value is multiplied by 10 and the new digit is added (= the current input value).
- When an operator key is pressed, the current input value is stored in an intermediate variable and the operator is also stored to calculate the next input value against the previously stored value.
- ....
Does that help? Of course, the above is just a rough sketch and not a complete calculator...
Best regards,
Manfred.