* Added overload for TryStroInt and integer with settings, fix issue #39237

This commit is contained in:
Michaël Van Canneyt 2022-10-03 21:23:21 +02:00
parent ad8c36e807
commit 2f73633813

View File

@ -290,6 +290,7 @@ Function SwapEndian(W : Word) : Word;
Function SwapEndian(C : Cardinal) : Cardinal;
function IntToStr(const Value: Integer): string;
Function TryStrToInt(const S : String; Out res : Integer) : Boolean;
Function TryStrToInt(const S : String; Out res : Integer; Const aSettings : TFormatSettings) : Boolean;
Function TryStrToInt(const S : String; Out res : NativeInt) : Boolean;
function TryStrToInt(const S: String; out res: NativeInt; Const aSettings : TFormatSettings): Boolean;
Function StrToIntDef(const S : String; Const aDef : Integer) : Integer;
@ -4794,6 +4795,21 @@ begin
Result:=IntTryStrToInt(S,res,aSettings.DecimalSeparator);
end;
function TryStrToInt(const S: String; out res: Integer; Const aSettings : TFormatSettings): Boolean;
Var
N : NativeInt;
begin
Result:=IntTryStrToInt(S,N,aSettings.DecimalSeparator);
if Result then
if (N<=MaxLongint) then
Res:=N
else
Result:=False;
end;
function StrToIntDef(const S: String; const aDef: Integer): Integer;
Var