|
|
@ -150,16 +150,19 @@ public class TransformMoney { |
|
|
|
//处理小数部分
|
|
|
|
if (parts.length == 2) { |
|
|
|
String decimalPart = parts[1]; //小数部分
|
|
|
|
for (int i = 0; i < decimalPart.length(); i++) { |
|
|
|
int num = Integer.valueOf(decimalPart.charAt(i) + ""); //提取数字,左起
|
|
|
|
result += big.charAt(num) + "" + units[1].charAt(i); //数字变大写加上单位
|
|
|
|
if ("0".equals(decimalPart)){//小数为零,则加上“整”
|
|
|
|
result += "整"; |
|
|
|
}else { |
|
|
|
for (int i = 0; i < decimalPart.length(); i++) { |
|
|
|
int num = Integer.valueOf(decimalPart.charAt(i) + ""); //提取数字,左起
|
|
|
|
result += big.charAt(num) + "" + units[1].charAt(i); //数字变大写加上单位
|
|
|
|
} |
|
|
|
result = result.replace("零角", "零"); //去掉"零角"的"角"
|
|
|
|
result = result.replace("零分", ""); //去掉"零分"
|
|
|
|
} |
|
|
|
result = result.replace("零角", "零"); //去掉"零角"的"角"
|
|
|
|
result = result.replace("零分", ""); //去掉"零分"
|
|
|
|
} else { |
|
|
|
result += "整"; //没有小数部分,则加上“整”
|
|
|
|
} |
|
|
|
|
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|