* Patch from N. Neumann, implement some delphi compatible StrToUint functions (bug id 37049)

git-svn-id: trunk@45336 -
This commit is contained in:
michael 2020-05-11 13:14:47 +00:00
parent 4afe1de02f
commit 50261464da
2 changed files with 18 additions and 0 deletions

View File

@ -979,6 +979,16 @@ begin
TryStrToDWord:=Error=0
end;
function StrToUInt(const s: string): Cardinal;
begin
StrToUInt:=StrToDWord(s);
end;
function TryStrToUInt(const s: string; out C: Cardinal): Boolean;
begin
TryStrToUInt:=TryStrToDWord(s, C);
end;
function TryStrToQWord(const s: string; Out Q: QWord): boolean;
var Error : word;
begin
@ -1011,6 +1021,11 @@ begin
if Error <> 0 then result := Default;
end;
function StrToUIntDef(const S: string; Default: Cardinal): Cardinal;
begin
Result:=StrToDWordDef(S, Default);
end;
{ StrToInt64Def converts the string S to an int64 value,
Default is returned in case S does not represent a valid int64 value }

View File

@ -122,16 +122,19 @@ function IntToHex(Value: Int64; Digits: integer): string;
function IntToHex(Value: QWord; Digits: integer): string; {$ifdef SYSUTILSINLINE}inline;{$ENDIF}
function StrToInt(const s: string): Longint;
function StrToDWord(const s: string): DWord;
function StrToUInt(const s: string): Cardinal;
function StrToInt64(const s: string): int64;
function StrToQWord(const s: string): QWord;
function StrToUInt64(const s: string): UInt64; inline;
function TryStrToInt(const s: string; Out i : Longint) : boolean;
function TryStrToDWord(const s: string; Out D : DWord) : boolean;
function TryStrToUInt(const s: string; out C: Cardinal): Boolean;
function TryStrToInt64(const s: string; Out i : int64) : boolean;
function TryStrToQWord(const s: string; Out Q : QWord) : boolean;
function TryStrToUInt64(const s: string; Out u : UInt64) : boolean; inline;
function StrToIntDef(const S: string; Default: Longint): Longint;
function StrToDWordDef(const S: string; Default: DWord): DWord;
function StrToUIntDef(const S: string; Default: Cardinal): Cardinal;
function StrToInt64Def(const S: string; Default: int64): int64;
function StrToQWordDef(const S: string; Default: QWord): QWord;
function StrToUInt64Def(const S: string; Default: UInt64): UInt64; inline;