mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
fix bug
This commit is contained in:
parent
95f00b8712
commit
858be6aafa
@ -63,7 +63,7 @@ public class NumberWordFormatter {
|
|||||||
int index = -1;
|
int index = -1;
|
||||||
double res = value;
|
double res = value;
|
||||||
while (res > 10 && (false == isTwo || index < 1)) {
|
while (res > 10 && (false == isTwo || index < 1)) {
|
||||||
if (res > 1000) {
|
if (res >= 1000) {
|
||||||
res = res / 1000;
|
res = res / 1000;
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
@ -31,4 +31,10 @@ public class NumberWordFormatTest {
|
|||||||
final String format5 = NumberWordFormatter.formatSimple(438);
|
final String format5 = NumberWordFormatter.formatSimple(438);
|
||||||
Assert.assertEquals("438", format5);
|
Assert.assertEquals("438", format5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void formatSimpleTest2(){
|
||||||
|
final String s = NumberWordFormatter.formatSimple(1000);
|
||||||
|
Assert.assertEquals("1k", s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user