如何从gwt中的客户端删除双倍指数。避免gwt中的双倍指数
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 [错误] [VFLOW] 359行:没有源代码可用于类型java.text.NumberFormat;你忘了继承一个必需的模块吗?
因为GWT不包括LIB的java.text JRE Emulation Reference
并且还我试图与的String.format( “%2f上。”,doubleResult);
是GWT中不支持String.format(),或者我做错了什么 在这里?
那么我怎样才能避免双指数?有什么办法吗?
当我把这种方法时抛出错误:java.lang.IllegalArgumentException异常:其他东西比一个Java对象从JSNI方法返回“@ com.client.test.ExponentTest ::格式这是此页上描述(D)':类型为int的JS值,期望的java.lang.Object – iMBMT 2012-07-05 12:52:13
= \尝试将“格式”的返回值更改为int或Object并查看发生了什么 – shem 2012-07-05 12:55:14
非常感谢。完成。我已经返回“”+ v.valueOf();. – iMBMT 2012-07-05 13:11:39