I am trying out google web toolkit for the first time by making a simple calculator app. I have a string I need to evaluate, for example “123+32”. How can I do this with GWT?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Because GWT is java, you’ll have to split your string, in
123+32, then turn the numeric strings into actual integers (Integer.parseInt) and then based on the operator string actually do the sum.I’m guessing you could also use JSNI and do a javascript
evalon the string, but remember that’s very dangerous unless you validate the user input, as they might end up running arbitrary code.