Hi, when using clocale unit on serveral linux distros we find that
ThousandSeparator=#0 and when using a format like '#,0.00 €' with a number like
1000 it ends with '1'. If thousandseparator=',' it would be formated like
'1,000.00 €' it is clear that inserting a #0 in such string when separator is
#0 is the problem. Attached is patch to fix it.
Related to this problem is that with clocale unit we can find monetary
separator and use it if number separator=#0, this is to make it "more delphi
compatible (if one is allowed to call it so)" because under windows number
separator is never #0.
It may happen that monetary separator is also #0 but in this case like when the
user manually set separator to #0 is handled above.
Jesus Reyes A.
¡Obtén la mejor experiencia en la web! Descarga gratis el nuevo Internet
Explorer 8. http://downloads.yahoo.com/ieak8/?l=mx
Index: unix/clocale.pp
===================================================================
--- unix/clocale.pp (revisión: 13008)
+++ unix/clocale.pp (copia de trabajo)
@@ -306,6 +306,9 @@
NegCurrFormat := NegFormatsTable[signp, prec, sep];
//Number stuff
ThousandSeparator:=GetLocaleChar(__THOUSANDS_SEP);
+ Sep := ord(GetLocaleChar(__MON_THOUSANDS_SEP));
+ if ThousandSeparator=#0 then
+ ThousandSeparator := char(Sep);
{$endif}
DecimalSeparator:=GetLocaleChar(RADIXCHAR);
end;
Index: objpas/sysutils/sysstr.inc
===================================================================
--- objpas/sysutils/sysstr.inc (revisión: 13008)
+++ objpas/sysutils/sysstr.inc (copia de trabajo)
@@ -1369,7 +1369,8 @@
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 @@
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 @@
End;
',':
Begin
- thousand := True;
+ thousand := DefaultFormatSettings.ThousandSeparator<>#0;
Inc(Fmt);
End;
'e', 'E':
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel