* Patch for "formatsettings" overloads of currency functions, mantis 15067

git-svn-id: trunk@14162 -
This commit is contained in:
marco 2009-11-13 09:10:24 +00:00
parent 5c2749d8ab
commit 5163b44ac6
2 changed files with 29 additions and 0 deletions

View File

@ -1691,6 +1691,13 @@ begin
Result:=FloatToStrF(Value,ffGeneral,-1,0);
end;
Function CurrToStr(Value: Currency; Const FormatSettings: TFormatSettings): string;
begin
Result:=FloatToStrF(Value,ffGeneral,-1,0,FormatSettings);
end;
function StrToCurr(const S: string): Currency;
begin
if not TextToFloat(PChar(pointer(S)), Result, fvCurrency) then
@ -1698,18 +1705,36 @@ begin
end;
function StrToCurr(const S: string; Const FormatSettings: TFormatSettings): Currency;
begin
if not TextToFloat(PChar(pointer(S)), Result, fvCurrency,FormatSettings) then
Raise EConvertError.createfmt(SInValidFLoat,[S]);
end;
Function TryStrToCurr(Const S : String; Out Value: Currency): Boolean;
Begin
Result := TextToFloat(PChar(pointer(S)), Value, fvCurrency);
End;
function TryStrToCurr(const S: string;Out Value : Currency; Const FormatSettings: TFormatSettings): Boolean;
Begin
Result := TextToFloat(PChar(pointer(S)), Value, fvCurrency,FormatSettings);
End;
function StrToCurrDef(const S: string; Default : Currency): Currency;
begin
if not TextToFloat(PChar(pointer(S)), Result, fvCurrency) then
Result:=Default;
end;
function StrToCurrDef(const S: string; Default : Currency; Const FormatSettings: TFormatSettings): Currency;
begin
if not TextToFloat(PChar(pointer(S)), Result, fvCurrency,FormatSettings) then
Result:=Default;
end;
{$endif FPUNONE}
function AnsiDequotedStr(const S: string; AQuote: Char): string;

View File

@ -195,9 +195,13 @@ Function FloattoCurr (Const Value : Extended) : Currency;
function TryFloatToCurr(const Value: Extended; var AResult: Currency): Boolean;
Function CurrToStr(Value: Currency): string;
Function CurrToStr(Value: Currency; Const FormatSettings: TFormatSettings): string;
function StrToCurr(const S: string): Currency;
function StrToCurr(const S: string; Const FormatSettings: TFormatSettings): Currency;
function TryStrToCurr(const S: string;Out Value : Currency): Boolean;
function TryStrToCurr(const S: string;Out Value : Currency; Const FormatSettings: TFormatSettings): Boolean;
function StrToCurrDef(const S: string; Default : Currency): Currency;
function StrToCurrDef(const S: string; Default : Currency; Const FormatSettings: TFormatSettings): Currency;
Function FloatToTextFmt(Buffer: PChar; Value: Extended; format: PChar; FormatSettings : TFormatSettings): Integer;
Function FloatToTextFmt(Buffer: PChar; Value: Extended; format: PChar): Integer;