Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jasper reports 如何在jasper报告中将字符串参数转换为双精度?_Jasper Reports_Ireport - Fatal编程技术网

Jasper reports 如何在jasper报告中将字符串参数转换为双精度?

Jasper reports 如何在jasper报告中将字符串参数转换为双精度?,jasper-reports,ireport,Jasper Reports,Ireport,我有一个字符串值(12.023)作为字符串,我想把它转换成两倍,并舍入这个值,然后在textfield上打印,如何做到这一点 my textfield expression is -> $P{totalAvgBytes} Expression class -> java.lang.String 我在学校里要做什么 Pattern Expr - > ????? 我喜欢模式Expr=Double.valueOf($p{totalAvgBytes})。 但它会抛出类似double

我有一个字符串值(12.023)作为字符串,我想把它转换成两倍,并舍入这个值,然后在textfield上打印,如何做到这一点

my textfield expression is -> $P{totalAvgBytes}
Expression class -> java.lang.String
我在学校里要做什么

Pattern Expr - > ?????
我喜欢模式
Expr=Double.valueOf($p{totalAvgBytes})。


但它会抛出类似double不能转换为字符串的错误。

尝试改用DecimalFormat类。它应该自动转换为字符串。它还将处理任何舍入


新的DecimalFormat(“##.#”)格式(Double.valueOf($p{totalAvgBytes})

尝试改用DecimalFormat类。它应该自动转换为字符串。它还将处理任何舍入

新的十进制格式(“##.#”)格式(Double.valueOf($p{totalAvgBytes})

的可能重复
""+Math.round((Double.valueOf($P{totalAvg}))) . It will do that.