mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-22 00:29:33 +02:00
* Patch for "formatsettings" overloads of currency functions, mantis 15067
git-svn-id: trunk@14162 -
This commit is contained in:
parent
5c2749d8ab
commit
5163b44ac6
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user