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) {
|
||||
if (o == null) return "null";
|
||||
else if (o instanceof Double d) {
|
||||
if (d % 1.0 != 0)
|
||||
return String.format(Locale.US, "%s", d);
|
||||
else
|
||||
return String.format(Locale.US, "%.0f", d);
|
||||
if (d % 1.0 == 0) return String.format(Locale.US, "%.0f", d);
|
||||
else if (d > 1) return String.format(Locale.US, "%.4f", d);
|
||||
else return String.format(Locale.US, "%s", d);
|
||||
} else if (o instanceof Throwable t) {
|
||||
try {
|
||||
return t.getMessage() + getStackTrace(t);
|
||||
|
|
Loading…
Reference in New Issue
Block a user