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);
}-*/;
精彩评论