Browse Source

[commons] news functions

Exilon 5 years ago
parent
commit
baec9a3edd
1 changed files with 16 additions and 0 deletions
  1. 16 0
      Quick.Commons.pas

+ 16 - 0
Quick.Commons.pas

@@ -366,6 +366,8 @@ type
   function RemoveLastChar(const aText : string) : string;
   function DateTimeToSQL(aDateTime : TDateTime) : string;
   function IsInteger(const aValue : string) : Boolean;
+  function IsFloat(const aValue : string) : Boolean;
+  function IsBoolean(const aValue : string) : Boolean;
   //extract a substring and deletes from source string
   function ExtractStr(var vSource : string; aIndex : Integer; aCount : Integer) : string;
   //get first string between string delimiters
@@ -1826,6 +1828,20 @@ begin
   Result := TryStrToInt(aValue,i);
 end;
 
+function IsFloat(const aValue : string) : Boolean;
+var
+  e : Extended;
+begin
+  Result := TryStrToFloat(aValue,e);
+end;
+
+function IsBoolean(const aValue : string) : Boolean;
+var
+  b : Boolean;
+begin
+  Result := TryStrToBool(aValue,b);
+end;
+
 function ExtractStr(var vSource : string; aIndex : Integer; aCount : Integer) : string;
 begin
   if aIndex > vSource.Length then Exit('');