类 UFormat
java.lang.Object
com.gdxsoft.easyweb.utils.UFormat
-
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static String返回年龄 当前年-出生年static StringformatChineseMoney(double n) 数字转汉字大写金额
参考: https://blog.csdn.net/weixin_42333548/article/details/124662824static StringformatDate(String toFormat, Object oriValue, String lang) 格式化日期static StringformatDecimalClearZero(Object oriValue) 清除小数末尾的0,最多保留4位小数static String格式化为整型static StringformatMoney(Object oriValue) 格式化为货币型static StringformatNumberClearZero(Object oriValue) 格式化为有逗号分隔的数字,并清除小数末尾的0,最多保留4位小数static StringformatPercent(Object oriValue) 格式为百分数static StringformatValue(String toFormat, Object oriValue, String lang) 格式化static StringformatWeek(Object oriValue, String lang) 格式化为星期static StringobjectToString(Object oriValue) 对象转字符串, Array通过", "拼接,用于处理ClickHouse的数组对象
-
字段详细资料
-
构造器详细资料
-
UFormat
public UFormat()
-
-
方法详细资料
-
formatChineseMoney
数字转汉字大写金额
参考: https://blog.csdn.net/weixin_42333548/article/details/124662824- 参数:
n- 数字- 返回:
-
formatValue
格式化- 参数:
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
对象转字符串, Array通过", "拼接,用于处理ClickHouse的数组对象- 参数:
oriValue- 原始对象- 返回:
- Array=a, b, c
-
formatAge
返回年龄 当前年-出生年- 参数:
dbo- 出生日期- 返回:
- 年龄
-
formatWeek
格式化为星期- 参数:
oriValue- 字符串或日期lang- enus 或 zhcn- 返回:
- 星期几
- 抛出:
Exception
-
formatDate
格式化日期- 参数:
toFormat- 格式 date,dateTime,time,dateShortTime,shortTime,shortDate,week 大小写无关oriValue- 来源数据,日期或字符型lang- 语言 enus 或 zhcn- 返回:
- 格式化后的字符
- 抛出:
Exception
-
formatInt
格式化为整型- 参数:
oriValue- 原始数据- 返回:
- 整型字符串
-
formatMoney
格式化为货币型- 参数:
oriValue- 原始数据- 返回:
- 小数点2位货币表达式
-
formatPercent
格式为百分数- 参数:
oriValue- 原始数据- 返回:
- 百分比
- 抛出:
Exception
-
formatNumberClearZero
格式化为有逗号分隔的数字,并清除小数末尾的0,最多保留4位小数- 参数:
oriValue- 数据- 返回:
- 格式化为有逗号分隔的数字,并清除小数末尾的0,最多保留4位小数
- 抛出:
Exception
-
formatDecimalClearZero
清除小数末尾的0,最多保留4位小数- 参数:
oriValue- 数据- 返回:
- 清除小数末尾的0,最多保留4位小数
- 抛出:
Exception
-