mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
add trillion
This commit is contained in:
parent
5a3e1cd8f6
commit
9e426dd3a5
@ -30,7 +30,7 @@ public class NumberWordFormatter {
|
|||||||
"FIFTEEN", "SIXTEEN", "SEVENTEEN", "EIGHTEEN", "NINETEEN"};
|
"FIFTEEN", "SIXTEEN", "SEVENTEEN", "EIGHTEEN", "NINETEEN"};
|
||||||
private static final String[] NUMBER_TEN = new String[]{"TEN", "TWENTY", "THIRTY", "FORTY", "FIFTY", "SIXTY",
|
private static final String[] NUMBER_TEN = new String[]{"TEN", "TWENTY", "THIRTY", "FORTY", "FIFTY", "SIXTY",
|
||||||
"SEVENTY", "EIGHTY", "NINETY"};
|
"SEVENTY", "EIGHTY", "NINETY"};
|
||||||
private static final String[] NUMBER_MORE = new String[]{"", "THOUSAND", "MILLION", "BILLION"};
|
private static final String[] NUMBER_MORE = new String[]{"", "THOUSAND", "MILLION", "BILLION", "TRILLION"};
|
||||||
|
|
||||||
private static final String[] NUMBER_SUFFIX = new String[]{"k", "w", "", "m", "", "", "b", "", "", "t", "", "", "p", "", "", "e"};
|
private static final String[] NUMBER_SUFFIX = new String[]{"k", "w", "", "m", "", "", "b", "", "", "t", "", "", "p", "", "", "e"};
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
package org.dromara.hutool.core.codec;
|
package org.dromara.hutool.core.codec;
|
||||||
|
|
||||||
import org.dromara.hutool.core.codec.binary.Base62;
|
import org.dromara.hutool.core.codec.binary.Base62;
|
||||||
|
import org.dromara.hutool.core.lang.Console;
|
||||||
import org.dromara.hutool.core.util.RandomUtil;
|
import org.dromara.hutool.core.util.RandomUtil;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
@ -60,4 +61,10 @@ public class Base62Test {
|
|||||||
final String decodeStr = Base62.decodeStrInverted(encode);
|
final String decodeStr = Base62.decodeStrInverted(encode);
|
||||||
Assertions.assertEquals(a, decodeStr);
|
Assertions.assertEquals(a, decodeStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void encodeNumbersTest() {
|
||||||
|
final String encode = Base62.encode("181338494");
|
||||||
|
Assertions.assertEquals("HRmWh8NiFvYi", encode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,9 @@ public class NumberWordFormatTest {
|
|||||||
|
|
||||||
final String format2 = NumberWordFormatter.format("2100.00");
|
final String format2 = NumberWordFormatter.format("2100.00");
|
||||||
Assertions.assertEquals("TWO THOUSAND ONE HUNDRED AND CENTS ONLY", format2);
|
Assertions.assertEquals("TWO THOUSAND ONE HUNDRED AND CENTS ONLY", format2);
|
||||||
|
|
||||||
|
final String format3 = NumberWordFormatter.format("1234567890123.12");
|
||||||
|
Assertions.assertEquals("ONE TRILLION TWO HUNDRED AND THIRTY FOUR BILLION FIVE HUNDRED AND SIXTY SEVEN MILLION EIGHT HUNDRED AND NINETY THOUSAND ONE HUNDRED AND TWENTY THREE AND CENTS TWELVE ONLY", format3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
x
Reference in New Issue
Block a user