如何在 gwt 中从客户端的 double 中删除指数。
public double evaluate(final double leftOperand, final double rightOperand) {
Double rtnValue = new Double(leftOperand * rightOperand);
//Require to write code which remove exponent before return
return rtnValue.doubleValue();
}
服务器端可以使用 NumberFormat
NumberFormat formatter = new DecimalFormat("#0.00");
System.out.println(number);
System.out.println(formatter.format(number));
但是客户端会抛出异常,例如: 16:08:04.190 [ERROR] [vflow] Line 359: No source code is available for type java.text.NumberFormat ; 你忘了继承一个必需的模块吗?
因为 gwt 不包含 lib java.text JRE Emulation Reference
而且我也试过String.format("%.2f", doubleResult);
GWT 不支持 String.format(),还是我在这里做错了什么?
那么我怎样才能避免双倍指数呢?有什么办法吗?