修复:格式化为中文日期时,0被处理为空串

This commit is contained in:
tjh 2022-01-18 15:39:44 +08:00
parent db5bd528ce
commit 4b02bc7287

View File

@ -164,6 +164,11 @@ 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){
// "十一"而非"一十一"