Class MoneyUtil

java.lang.Object
com.sure.tool.util.MoneyUtil

public class MoneyUtil extends Object
金额工具类:人民币金额转中文大写(财务报销/合同常用),零依赖。

支持负数、0~万亿级整数部分、角分处理;负数输出「负」前缀,无角分时输出「整」。

Since:
0.2.0
Author:
suretool
  • Method Details

    • toChinese

      public static String toChinese(BigDecimal amount)
      金额转中文大写。
      Parameters:
      amount - 金额(元,支持小数,四舍五入到分)
      Returns:
      中文大写,如 壹佰贰拾叁元肆角伍分;null 返回 null
    • toChinese

      public static String toChinese(double amount)
      金额转中文大写(double 重载,内部转 BigDecimal 避免浮点误差)。
      Parameters:
      amount - 金额(元)
      Returns:
      中文大写
    • toChinese

      public static String toChinese(String amount)
      金额转中文大写(字符串重载)。
      Parameters:
      amount - 金额字符串,如 "123.45"
      Returns:
      中文大写;非法字符串返回 null