Tweak number format
All checks were successful
ci/woodpecker/manual/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/manual/woodpecker Pipeline was successful
This commit is contained in:
parent
3d398cc0b2
commit
4512d8741d
|
@ -7,10 +7,9 @@ public class StringFormatter {
|
||||||
public static String toString(Object o) {
|
public static String toString(Object o) {
|
||||||
if (o == null) return "null";
|
if (o == null) return "null";
|
||||||
else if (o instanceof Double d) {
|
else if (o instanceof Double d) {
|
||||||
if (d % 1.0 != 0)
|
if (d % 1.0 == 0) return String.format(Locale.US, "%.0f", d);
|
||||||
return String.format(Locale.US, "%s", d);
|
else if (d > 1) return String.format(Locale.US, "%.4f", d);
|
||||||
else
|
else return String.format(Locale.US, "%s", d);
|
||||||
return String.format(Locale.US, "%.0f", d);
|
|
||||||
} else if (o instanceof Throwable t) {
|
} else if (o instanceof Throwable t) {
|
||||||
try {
|
try {
|
||||||
return t.getMessage() + getStackTrace(t);
|
return t.getMessage() + getStackTrace(t);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user