Browse Source

# revisions: 45336

git-svn-id: branches/fixes_3_2@45688 -
marco 5 years ago
parent
commit
b9e071c1c2
2 changed files with 18 additions and 0 deletions
  1. 15 0
      rtl/objpas/sysutils/sysstr.inc
  2. 3 0
      rtl/objpas/sysutils/sysstrh.inc

+ 15 - 0
rtl/objpas/sysutils/sysstr.inc

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

+ 3 - 0
rtl/objpas/sysutils/sysstrh.inc

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