mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 02:19:27 +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);
|
Result:=FloatToStrF(Value,ffGeneral,-1,0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Function CurrToStr(Value: Currency; Const FormatSettings: TFormatSettings): string;
|
||||||
|
begin
|
||||||
|
Result:=FloatToStrF(Value,ffGeneral,-1,0,FormatSettings);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
function StrToCurr(const S: string): Currency;
|
function StrToCurr(const S: string): Currency;
|
||||||
begin
|
begin
|
||||||
if not TextToFloat(PChar(pointer(S)), Result, fvCurrency) then
|
if not TextToFloat(PChar(pointer(S)), Result, fvCurrency) then
|
||||||
@ -1698,18 +1705,36 @@ begin
|
|||||||
end;
|
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;
|
Function TryStrToCurr(Const S : String; Out Value: Currency): Boolean;
|
||||||
Begin
|
Begin
|
||||||
Result := TextToFloat(PChar(pointer(S)), Value, fvCurrency);
|
Result := TextToFloat(PChar(pointer(S)), Value, fvCurrency);
|
||||||
End;
|
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;
|
function StrToCurrDef(const S: string; Default : Currency): Currency;
|
||||||
begin
|
begin
|
||||||
if not TextToFloat(PChar(pointer(S)), Result, fvCurrency) then
|
if not TextToFloat(PChar(pointer(S)), Result, fvCurrency) then
|
||||||
Result:=Default;
|
Result:=Default;
|
||||||
end;
|
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}
|
{$endif FPUNONE}
|
||||||
|
|
||||||
function AnsiDequotedStr(const S: string; AQuote: Char): string;
|
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 TryFloatToCurr(const Value: Extended; var AResult: Currency): Boolean;
|
||||||
|
|
||||||
Function CurrToStr(Value: Currency): string;
|
Function CurrToStr(Value: Currency): string;
|
||||||
|
Function CurrToStr(Value: Currency; Const FormatSettings: TFormatSettings): string;
|
||||||
function StrToCurr(const S: string): Currency;
|
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): 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): 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; FormatSettings : TFormatSettings): Integer;
|
||||||
Function FloatToTextFmt(Buffer: PChar; Value: Extended; format: PChar): Integer;
|
Function FloatToTextFmt(Buffer: PChar; Value: Extended; format: PChar): Integer;
|
||||||
|
Loading…
Reference in New Issue
Block a user