fixed format bug regarding tailing zeros

Took 42 seconds
This commit is contained in:
Kiran Hart 2022-03-23 02:09:22 -04:00
parent 2dff93cd48
commit b84feb26d6

View File

@ -421,10 +421,13 @@ public class AuctionAPI {
// do the zero drop here
// this is a bit scuffed, I gotta improve this
if (Double.parseDouble(formatted.replace(",", "")) % 1 == 0 && Settings.STRIP_ZEROS_ON_WHOLE_NUMBERS.getBoolean()) {
formatted = formatted.replaceAll("0+$", "");
if (formatted.endsWith("."))
formatted = formatted.substring(0, formatted.length() - 1);
if (Settings.STRIP_ZEROS_ON_WHOLE_NUMBERS.getBoolean()) {
if (Double.parseDouble(formatted.replace(",", "")) % 1 == 0) {
formatted = formatted.replaceAll("0+$", "");
if (formatted.endsWith("."))
formatted = formatted.substring(0, formatted.length() - 1);
}
}
String preDecimal = Settings.USE_ALTERNATE_CURRENCY_FORMAT.getBoolean() ? replaceLast(formatted.replace(",", "."), ".", ",") : formatted;