16 lines
423 B
Java
16 lines
423 B
Java
package io.gitlab.jfronny.commons;
|
|
|
|
import java.util.*;
|
|
|
|
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);
|
|
} else return o.toString();
|
|
}
|
|
}
|