From e8edc31a896be8cb798951ec7842b2249120f783 Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Thu, 23 Apr 2009 19:16:49 +0000 Subject: [PATCH] * don't insert thousandseparator if it is #0 (mantis #13552, patch by Jesus Reyes) git-svn-id: trunk@13028 - --- .gitattributes | 1 + rtl/objpas/sysutils/sysstr.inc | 8 +++++--- tests/webtbs/tw13552.pp | 13 +++++++++++++ 3 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 tests/webtbs/tw13552.pp diff --git a/.gitattributes b/.gitattributes index 40f5eec40d..f4e68ed4a4 100644 --- a/.gitattributes +++ b/.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 diff --git a/rtl/objpas/sysutils/sysstr.inc b/rtl/objpas/sysutils/sysstr.inc index 6438b5adee..94578c760b 100644 --- a/rtl/objpas/sysutils/sysstr.inc +++ b/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': diff --git a/tests/webtbs/tw13552.pp b/tests/webtbs/tw13552.pp new file mode 100644 index 0000000000..dcf1abda9f --- /dev/null +++ b/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.