2
2
3
3
import java .math .BigInteger ;
4
4
import java .text .DecimalFormat ;
5
+ import java .text .DecimalFormatSymbols ;
5
6
import java .time .Instant ;
6
7
import java .time .format .DateTimeFormatter ;
7
8
import java .time .format .DateTimeFormatterBuilder ;
@@ -17,6 +18,13 @@ public class Text {
17
18
private static final int WHITESPACE_LENGTH = 32 ;
18
19
private static final String ZEROS_9 = "000000000" ;
19
20
private static String WHITESPACE_32 = " " ; // 32 spaces
21
+ private static DecimalFormatSymbols symbols ;
22
+
23
+ static {
24
+ symbols = new DecimalFormatSymbols ();
25
+ symbols .setDecimalSeparator ('.' );
26
+ symbols .setGroupingSeparator (',' );
27
+ }
20
28
21
29
/**
22
30
* Return true if the character is an ASCII numeric digit
@@ -65,18 +73,18 @@ public static String rightPad(long value, int length) {
65
73
return rightPad (Long .toString (value ), length );
66
74
}
67
75
68
- static DecimalFormat balanceFormatter = new DecimalFormat ("#,###" );
76
+ static DecimalFormat balanceFormatter = new DecimalFormat ("#,###" , symbols );
69
77
70
78
public static String toFriendlyNumber (long value ) {
71
79
return balanceFormatter .format (value );
72
80
}
73
81
74
- static DecimalFormat percentFormatter = new DecimalFormat ("##.###%" );
82
+ static DecimalFormat percentFormatter = new DecimalFormat ("##.###%" , symbols );
75
83
public static String toPercentString (double value ) {
76
84
return percentFormatter .format (value );
77
85
}
78
86
79
- static DecimalFormat decimalFormatter = new DecimalFormat ("#,##0.####" );
87
+ static DecimalFormat decimalFormatter = new DecimalFormat ("#,##0.####" , symbols );
80
88
public static String toFriendlyDecimal (double value ) {
81
89
if (!Double .isFinite (value )) return CVMDouble .create (value ).toString ();
82
90
return decimalFormatter .format (value );
0 commit comments