|
|
@@ -17,10 +17,13 @@ public class ChineseMoneyUtils {
|
|
|
* @return 返一个转换好的字符串
|
|
|
*/
|
|
|
public static String numberToChinese(double tempNumber) {
|
|
|
- String result = cleanZero(splitNum(round(tempNumber)));
|
|
|
- if (!result.contains("分") && !result.contains("角")) {
|
|
|
+ String result = cleanZero(splitNum(round(Math.abs(tempNumber))));
|
|
|
+ if (!result.contains("分")) {
|
|
|
result += "整";
|
|
|
}
|
|
|
+ if (tempNumber < 0) {
|
|
|
+ result = "-" + result;
|
|
|
+ }
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
@@ -171,4 +174,5 @@ public class ChineseMoneyUtils {
|
|
|
s = s.replaceAll("亿万", "亿");
|
|
|
return s;
|
|
|
}
|
|
|
+
|
|
|
}
|