|
@@ -7,7 +7,7 @@
|
|
Author : Kike Pérez
|
|
Author : Kike Pérez
|
|
Version : 1.8
|
|
Version : 1.8
|
|
Created : 14/07/2017
|
|
Created : 14/07/2017
|
|
- Modified : 27/08/2019
|
|
|
|
|
|
+ Modified : 15/09/2019
|
|
|
|
|
|
This file is part of QuickLib: https://github.com/exilon/QuickLib
|
|
This file is part of QuickLib: https://github.com/exilon/QuickLib
|
|
|
|
|
|
@@ -174,6 +174,8 @@ type
|
|
|
|
|
|
//generates a random password with complexity options
|
|
//generates a random password with complexity options
|
|
function RandomPassword(const PasswordLength : Integer; Complexity : TPasswordComplexity = [pfIncludeNumbers,pfIncludeSigns]) : string;
|
|
function RandomPassword(const PasswordLength : Integer; Complexity : TPasswordComplexity = [pfIncludeNumbers,pfIncludeSigns]) : string;
|
|
|
|
+ //generates a random string
|
|
|
|
+ function RandomString(const aLength: Integer) : string;
|
|
//extracts file extension from a filename
|
|
//extracts file extension from a filename
|
|
function ExtractFileNameWithoutExt(const FileName: string): string;
|
|
function ExtractFileNameWithoutExt(const FileName: string): string;
|
|
//converts a Unix path to Windows path
|
|
//converts a Unix path to Windows path
|
|
@@ -429,6 +431,21 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+function RandomString(const aLength: Integer) : string;
|
|
|
|
+const
|
|
|
|
+ chars : string = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
|
|
|
|
+var
|
|
|
|
+ i : Integer;
|
|
|
|
+ clong : Integer;
|
|
|
|
+begin
|
|
|
|
+ clong := High(chars);
|
|
|
|
+ SetLength(Result, aLength);
|
|
|
|
+ for i := 1 to aLength do
|
|
|
|
+ begin
|
|
|
|
+ Result[i] := chars[Random(clong) + 1];
|
|
|
|
+ end;
|
|
|
|
+end;
|
|
|
|
+
|
|
function ExtractFileNameWithoutExt(const FileName: string): string;
|
|
function ExtractFileNameWithoutExt(const FileName: string): string;
|
|
begin
|
|
begin
|
|
Result := TPath.GetFileNameWithoutExtension(FileName);
|
|
Result := TPath.GetFileNameWithoutExtension(FileName);
|