2
0
Эх сурвалжийг харах

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

Michaël Van Canneyt 2 жил өмнө
parent
commit
2f73633813

+ 16 - 0
packages/rtl/sysutils.pas

@@ -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