开发者

Arithmetic operations evaluation in GWT

Is there any library / module for simple arithmetic operations evaluation for GWT?

For example开发者_开发问答, some method which could transform string "14 + (28 * 10)" to 294?

I know, that there's arity for Java. I need something more lightweight which would work in GWT.


Javascript's eval should be adequate. Using JSNI from your Java code:

public void test() {
    double result = calculate("14 + (28 * 10)");
}

public final native double calculate(String op) /*-{
    return eval(op);
}-*/;
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜