Explorar o código

* don't insert thousandseparator if it is #0 (mantis #13552, patch by
Jesus Reyes)

git-svn-id: trunk@13028 -

Jonas Maebe %!s(int64=16) %!d(string=hai) anos
pai
achega
e8edc31a89
Modificáronse 3 ficheiros con 19 adicións e 3 borrados
  1. 1 0
      .gitattributes
  2. 5 3
      rtl/objpas/sysutils/sysstr.inc
  3. 13 0
      tests/webtbs/tw13552.pp

+ 1 - 0
.gitattributes

@@ -8823,6 +8823,7 @@ tests/webtbs/tw13456.pp svneol=native#text/plain
 tests/webtbs/tw1348.pp svneol=native#text/plain
 tests/webtbs/tw1351.pp svneol=native#text/plain
 tests/webtbs/tw13536.pp svneol=native#text/plain
+tests/webtbs/tw13552.pp svneol=native#text/plain
 tests/webtbs/tw13553.pp svneol=native#text/plain
 tests/webtbs/tw13563.pp svneol=native#text/plain
 tests/webtbs/tw1364.pp svneol=native#text/plain

+ 5 - 3
rtl/objpas/sysutils/sysstr.inc

@@ -1369,7 +1369,8 @@ Begin
         Dec(P, 3);
         While (P > 1) Do
         Begin
-          If Result[P - 1] <> '-' Then Insert(FormatSettings.ThousandSeparator, Result, P);
+          If (Result[P - 1] <> '-') And (FormatSettings.ThousandSeparator <> #0) Then
+            Insert(FormatSettings.ThousandSeparator, Result, P);
           Dec(P, 3);
         End;
       End;
@@ -1401,7 +1402,8 @@ Begin
         Dec(P, 3);
         While (P > 1) Do
         Begin
-          Insert(FormatSettings.ThousandSeparator, Result, P);
+          If FormatSettings.ThousandSeparator<>#0 Then
+            Insert(FormatSettings.ThousandSeparator, Result, P);
           Dec(P, 3);
         End;
 
@@ -1954,7 +1956,7 @@ Var
               End;
             ',':
               Begin
-              thousand := True;
+              thousand := DefaultFormatSettings.ThousandSeparator<>#0;
               Inc(Fmt);
               End;
             'e', 'E':

+ 13 - 0
tests/webtbs/tw13552.pp

@@ -0,0 +1,13 @@
+uses
+  sysutils;
+
+var
+  s: ansistring;
+begin
+  ThousandSeparator:=#0;
+  DecimalSeparator:='.';
+  s:=formatfloat('#,0.00',1000.0);
+  writeln(s);
+  if (s<>'1000.00') then
+    halt(1);
+end.