From d65f36f1225831971464d465d0122fe48966b790 Mon Sep 17 00:00:00 2001 From: woodser Date: Wed, 11 Oct 2023 16:33:44 -0400 Subject: [PATCH] fix decimal formatting to US convention (no commas) in offer book --- core/src/main/java/haveno/core/trade/HavenoUtils.java | 2 +- core/src/main/java/haveno/core/util/VolumeUtil.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/haveno/core/trade/HavenoUtils.java b/core/src/main/java/haveno/core/trade/HavenoUtils.java index c41a96d5..329a5f10 100644 --- a/core/src/main/java/haveno/core/trade/HavenoUtils.java +++ b/core/src/main/java/haveno/core/trade/HavenoUtils.java @@ -63,7 +63,7 @@ import org.bitcoinj.core.Coin; public class HavenoUtils { // Use the US locale as a base for all DecimalFormats (commas should be omitted from number strings). - private static final DecimalFormatSymbols DECIMAL_FORMAT_SYMBOLS = DecimalFormatSymbols.getInstance(Locale.US); + public static final DecimalFormatSymbols DECIMAL_FORMAT_SYMBOLS = DecimalFormatSymbols.getInstance(Locale.US); public static int XMR_SMALLEST_UNIT_EXPONENT = 12; public static final String LOOPBACK_HOST = "127.0.0.1"; // local loopback address to host Monero node public static final String LOCALHOST = "localhost"; diff --git a/core/src/main/java/haveno/core/util/VolumeUtil.java b/core/src/main/java/haveno/core/util/VolumeUtil.java index 816390a6..c92b190e 100644 --- a/core/src/main/java/haveno/core/util/VolumeUtil.java +++ b/core/src/main/java/haveno/core/util/VolumeUtil.java @@ -65,7 +65,7 @@ public class VolumeUtil { } public static Volume getRoundedVolumePrecise(Volume volumeByAmount) { - DecimalFormat decimalFormat = new DecimalFormat("#.####"); + DecimalFormat decimalFormat = new DecimalFormat("#.####", HavenoUtils.DECIMAL_FORMAT_SYMBOLS); double roundedVolume = Double.parseDouble(decimalFormat.format(Double.parseDouble(volumeByAmount.toString()))); return Volume.parse(String.valueOf(roundedVolume), volumeByAmount.getCurrencyCode()); }