开发者

Google Web Toolkit Evaluate String

I am trying out google web toolkit for the first time by making a simple calculator app. I have a string I need to e开发者_Python百科valuate, for example "123+32". How can I do this with GWT?


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 eval on the string, but remember that's very dangerous unless you validate the user input, as they might end up running arbitrary code.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜