怎么将ireport 金额转换为大写
java代码金额小写转大写类
package cn.etcom.report;
import java.text.DecimalFormat;
import net.sf.jasperreports.engine.JRAbstractScriptlet;
import net.sf.jasperreports.engine.JRScriptletException;
public class ToChina extends JRAbstractScriptlet{
private static String HanDigiStr[] = new String[] { "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" };
private static String HanDiviStr[] = new String[] { "", "拾", "佰", "仟", "万", "拾", "佰", "仟", "亿", "拾", "佰", "仟", "万",
"拾", "佰", "仟", "亿", "拾", "佰", "仟", "万", "拾", "佰", "仟" };
public void toChinaUpper(){
}
public String toChinaUpper(String money) throws Exception {
Double val= Double.parseDouble(money);
DecimalFormat df = new DecimalFormat("0.00");
df.format(val);
String SignStr = "";
String TailStr = "";
long fraction, integer;
int jiao, fen;
if (val < 0) {
val = -val;
SignStr = "负";
}
if (val > 99999999999999.999 || val < -99999999999999.999) {
return "数值位数过大!";
}
// 四舍五入到分
long temp = Math.round(val * 100);
integer = temp / 100;
fraction = temp % 100;
jiao = (int) fraction / 10;
fen = (int) fraction % 10;
if (jiao == 0 && fen == 0) {
TailStr = "整"