Browse Source

+ Added FormatCurr by Uberto Barbini

michael 20 years ago
parent
commit
525e2cf1ff
2 changed files with 15 additions and 4 deletions
  1. 10 3
      rtl/objpas/sysutils/sysstr.inc
  2. 5 1
      rtl/objpas/sysutils/sysstrh.inc

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

@@ -947,7 +947,7 @@ Begin
   P:=Pos(DecimalSeparator,S);
   P:=Pos(DecimalSeparator,S);
   If (P<>0) Then
   If (P<>0) Then
     S[P] := '.';
     S[P] := '.';
-  Val(S,Value,E);
+  Val(trim(S),Value,E);
   Result:=(E=0);
   Result:=(E=0);
 End;
 End;
 
 
@@ -1791,7 +1791,11 @@ Begin
   Result:=StrPas(@Buf);
   Result:=StrPas(@Buf);
 End;
 End;
 
 
-
+function FormatCurr(const Format: string; Value: Currency): string;
+begin
+  Result := FormatFloat(Format, Value);
+end;
+  
 
 
 {==============================================================================}
 {==============================================================================}
 {   extra functions                                                            }
 {   extra functions                                                            }
@@ -2094,7 +2098,10 @@ const
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.35  2005-03-25 22:53:39  jonas
+  Revision 1.36  2005-04-26 16:40:51  michael
+  + Added FormatCurr by Uberto Barbini
+
+  Revision 1.35  2005/03/25 22:53:39  jonas
     * fixed several warnings and notes about unused variables (mainly) or
     * fixed several warnings and notes about unused variables (mainly) or
       uninitialised use of variables/function results (a few)
       uninitialised use of variables/function results (a few)
 
 

+ 5 - 1
rtl/objpas/sysutils/sysstrh.inc

@@ -161,6 +161,7 @@ Function FloatToTextFmt(Buffer: PChar; Value: Extended; format: PChar): Integer;
 Procedure FloatToDecimal(Var Result: TFloatRec; Value: Extended; Precision, Decimals : integer);
 Procedure FloatToDecimal(Var Result: TFloatRec; Value: Extended; Precision, Decimals : integer);
 Function FormatFloat(Const Format : String; Value : Extended) : String;
 Function FormatFloat(Const Format : String; Value : Extended) : String;
 Function IsDelimiter(const Delimiters, S: string; Index: Integer): Boolean;
 Function IsDelimiter(const Delimiters, S: string; Index: Integer): Boolean;
+function FormatCurr(const Format: string; Value: Currency): string;
 
 
 {// MBCS Functions. No MBCS yet, so mostly these are calls to the regular counterparts.}
 {// MBCS Functions. No MBCS yet, so mostly these are calls to the regular counterparts.}
 Type
 Type
@@ -202,7 +203,10 @@ function BCDToInt(Value: integer): integer;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.16  2005-03-12 14:56:22  florian
+  Revision 1.17  2005-04-26 16:40:51  michael
+  + Added FormatCurr by Uberto Barbini
+
+  Revision 1.16  2005/03/12 14:56:22  florian
     + added Ansi* routines to widestring manager
     + added Ansi* routines to widestring manager
     * made them using OS calls on windows
     * made them using OS calls on windows