mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix bug
This commit is contained in:
@@ -165,10 +165,6 @@ public class NumberChineseFormatter {
|
||||
public static String formatThousand(int amount, boolean isUseTraditional){
|
||||
Assert.checkBetween(amount, -999, 999, "Number support only: (-999 ~ 999)!");
|
||||
|
||||
// thousandToChinese方法对0不处理,此处直接返回"零"
|
||||
if (amount == 0) {
|
||||
return String.valueOf(DIGITS[0]);
|
||||
}
|
||||
final String chinese = thousandToChinese(amount, isUseTraditional);
|
||||
if(amount < 20 && amount > 10){
|
||||
// "十一"而非"一十一"
|
||||
@@ -289,6 +285,11 @@ public class NumberChineseFormatter {
|
||||
* @return 转换后的汉字
|
||||
*/
|
||||
private static String thousandToChinese(int amountPart, boolean isUseTraditional) {
|
||||
if (amountPart == 0) {
|
||||
// issue#I4R92H@Gitee
|
||||
return String.valueOf(DIGITS[0]);
|
||||
}
|
||||
|
||||
int temp = amountPart;
|
||||
|
||||
StringBuilder chineseStr = new StringBuilder();
|
||||
|
@@ -555,7 +555,7 @@ public class CalendarUtil {
|
||||
result.append(NumberChineseFormatter.formatThousand(day, false));
|
||||
result.append('日');
|
||||
|
||||
// 时分秒中零不需要替换
|
||||
// 只替换年月日,时分秒中零不需要替换
|
||||
String temp = result.toString().replace('零', '〇');
|
||||
result.delete(0, result.length());
|
||||
result.append(temp);
|
||||
|
Reference in New Issue
Block a user