public class EnglishNumberFormatter extends Object
| Constructor and Description |
|---|
EnglishNumberFormatter() |
| Modifier and Type | Method and Description |
|---|---|
static String |
format(Object x)
将阿拉伯数字转为英文表达式
|
static String |
formatSimple(long value)
将阿拉伯数字转化为简洁计数单位,例如 2100 =》 2.1k
范围默认只到w
|
static String |
formatSimple(long value,
boolean isTwo)
将阿拉伯数字转化为简介计数单位,例如 2100 =》 2.1k
|
public static String format(Object x)
x - 阿拉伯数字,可以为Number对象,也可以是普通对象,最后会使用字符串方式处理public static String formatSimple(long value)
value - 被格式化的数字public static String formatSimple(long value, boolean isTwo)
value - 对应数字的值isTwo - 控制是否为只为k、w,例如当为false时返回4.38m,true返回438.43wCopyright © 2025. All rights reserved.