File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ class StringUtil {
8787 }
8888
8989 #if !macro // stringtools gets used in macros, but some functions rely on haxeui "bits" (like locales), lets wrap to avoid problems
90- private static var humanReadableRegex = ~/ \B (?=(\d {3} )+ (?!\d ))( ? <! \. \d * ) / g ;
90+ private static var humanReadableRegex = ~/ \B (?=(\d {3} )+ (?!\d ))/ g ;
9191 private static inline var THOUSAND : Int = 1000 ;
9292 private static inline var MILLION : Int = THOUSAND * THOUSAND ;
9393 private static inline var BILLION : Int = MILLION * THOUSAND ;
@@ -122,13 +122,22 @@ class StringUtil {
122122 var p = s .indexOf (" ." );
123123 if (p == - 1 && precision > 0 ) {
124124 p = s .length ;
125- s + = " . " ;
125+ s + = haxe.ui.locale. Formats . decimalSeparator ;
126126 }
127127 s = StringTools .rpad (s , " 0" , p + precision + 1 );
128128 }
129129 s + = suffix ;
130130 } else {
131- s = humanReadableRegex .replace (s , haxe.ui.locale. Formats .thousandsSeparator );
131+ var decimalSeparatorIndex = s .indexOf (" ." );
132+ if (decimalSeparatorIndex == - 1 ) {
133+ s = humanReadableRegex .replace (s , haxe.ui.locale. Formats .thousandsSeparator );
134+ } else {
135+ var integerPart = s .substring (0 , s .indexOf (" ." ));
136+ var decimalPart = s .substring (s .indexOf (" ." ) + 1 );
137+ s = humanReadableRegex .replace (integerPart , haxe.ui.locale. Formats .thousandsSeparator );
138+ s + = haxe.ui.locale. Formats .decimalSeparator ;
139+ s + = decimalPart ;
140+ }
132141 }
133142
134143 return s ;
You can’t perform that action at this time.
0 commit comments