0

i'm creating a calculator and i want to convert the operation on the JTextField from string to int to solve it and show the result on the same JTextField

mery
  • 43
  • 7
  • Are you saying that if I type `34TF82` you want `34`? `82`? `3482`? Or are you saying if I type `34+82` you want `116`? – Andreas Feb 05 '18 at 21:56
  • that's exactly what i want "if I type 34+82 you want 116? " – mery Feb 05 '18 at 21:57
  • [java parse equation](https://www.google.com.au/search?q=java+parse+equation+string&gws_rd=cr&dcr=0&ei=ltN4WtmmDYW_0QSu-oHwBA) – MadProgrammer Feb 05 '18 at 21:59
  • @MadProgrammer do i have to write an equation? – mery Feb 05 '18 at 22:18
  • @Andreas is there a way to do it? – mery Feb 05 '18 at 22:18
  • @mery Yes, you click the link to navigate to the duplicate question, then scroll down to the first answer, which is the accepted answer as indicated by the green check mark, then you **read the answer** to learn how you can evaluate an expression in a string and get the result of the expression back. If you need further instructions in how you use a web browser to navigate links, or how to read code displayed on a web page, then I'm sorry, that is out of scope for StackOverflow. – Andreas Feb 05 '18 at 22:22
  • @mery That would depend on your requirements, do you want to take the text `1+1` from the text field and evaluate the equation or do you want to act more like a calculator, when numbers and functions are entered in sequence – MadProgrammer Feb 05 '18 at 22:30
  • thanks @MadProgrammer – mery Feb 07 '18 at 23:25

0 Answers0