类 UFormat

java.lang.Object
com.gdxsoft.easyweb.utils.UFormat

public class UFormat extends Object
  • 字段详细资料

    • DATE_FROMAT_UK

      public static final String DATE_FROMAT_UK
      英式日期表达式
      另请参阅:
    • DATE_FROMAT_US

      public static final String DATE_FROMAT_US
      美式日期表达式
      另请参阅:
    • DATE_FROMAT_ZHCN

      public static String DATE_FROMAT_ZHCN
    • DATE_FROMAT_ENUS

      public static String DATE_FROMAT_ENUS
  • 构造器详细资料

    • UFormat

      public UFormat()
  • 方法详细资料

    • formatChineseMoney

      public static String formatChineseMoney(double n)
      数字转汉字大写金额
      参考: https://blog.csdn.net/weixin_42333548/article/details/124662824
      参数:
      n - 数字
      返回:
    • formatValue

      public static String formatValue(String toFormat, Object oriValue, String lang) throws Exception
      格式化
      参数:
      toFormat - 要转换的类型,大小写无关
      1 date,dateTime,time,dateShortTime,shortTime,shortDate
      2 age 年龄, int, Money
      3 fixed2 保留2位小数
      4 leastMoney 清除小数后的0
      5 leastDecimal 清除小数后的0,没有逗号
      6 percent 百分比格式
      7 week 星期
      8 ChineseMoney 中文货币
      oriValue - 原始值
      lang - 语言 enus 或 zhcn
      返回:
      格式化好的字符串
      抛出:
      Exception
    • objectToString

      public static String objectToString(Object oriValue)
      对象转字符串, Array通过", "拼接,用于处理ClickHouse的数组对象
      参数:
      oriValue - 原始对象
      返回:
      Array=a, b, c
    • formatAge

      public static String formatAge(Object dbo)
      返回年龄 当前年-出生年
      参数:
      dbo - 出生日期
      返回:
      年龄
    • formatWeek

      public static String formatWeek(Object oriValue, String lang) throws Exception
      格式化为星期
      参数:
      oriValue - 字符串或日期
      lang - enus 或 zhcn
      返回:
      星期几
      抛出:
      Exception
    • formatDate

      public static String formatDate(String toFormat, Object oriValue, String lang) throws Exception
      格式化日期
      参数:
      toFormat - 格式 date,dateTime,time,dateShortTime,shortTime,shortDate,week 大小写无关
      oriValue - 来源数据,日期或字符型
      lang - 语言 enus 或 zhcn
      返回:
      格式化后的字符
      抛出:
      Exception
    • formatInt

      public static String formatInt(Object oriValue)
      格式化为整型
      参数:
      oriValue - 原始数据
      返回:
      整型字符串
    • formatMoney

      public static String formatMoney(Object oriValue)
      格式化为货币型
      参数:
      oriValue - 原始数据
      返回:
      小数点2位货币表达式
    • formatPercent

      public static String formatPercent(Object oriValue) throws Exception
      格式为百分数
      参数:
      oriValue - 原始数据
      返回:
      百分比
      抛出:
      Exception
    • formatNumberClearZero

      public static String formatNumberClearZero(Object oriValue) throws Exception
      格式化为有逗号分隔的数字,并清除小数末尾的0,最多保留4位小数
      参数:
      oriValue - 数据
      返回:
      格式化为有逗号分隔的数字,并清除小数末尾的0,最多保留4位小数
      抛出:
      Exception
    • formatDecimalClearZero

      public static String formatDecimalClearZero(Object oriValue) throws Exception
      清除小数末尾的0,最多保留4位小数
      参数:
      oriValue - 数据
      返回:
      清除小数末尾的0,最多保留4位小数
      抛出:
      Exception