Changeset 108 for trunk/Packages/Common/UCommon.pas
- Timestamp:
- Feb 11, 2022, 11:31:42 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/Common/UCommon.pas
r98 r108 13 13 type 14 14 TArrayOfByte = array of Byte; 15 TArrayOfString = array of string;16 15 TExceptionEvent = procedure(Sender: TObject; E: Exception) of object; 17 16 … … 51 50 function ComputerName: string; 52 51 procedure DeleteFiles(APath, AFileSpec: string); 52 function Explode(Separator: Char; Data: string): TStringArray; 53 53 procedure ExecuteProgram(Executable: string; Parameters: array of string); 54 54 procedure FileDialogUpdateFilterFileType(FileDialog: TOpenDialog); … … 65 65 function LoadFileToStr(const FileName: TFileName): AnsiString; 66 66 function LoggedOnUserNameEx(Format: TUserNameFormat): string; 67 function MergeArray(A, B: array of string): T ArrayOfString;67 function MergeArray(A, B: array of string): TStringArray; 68 68 function OccurenceOfChar(What: Char; Where: string): Integer; 69 69 procedure OpenWebPage(URL: string); … … 291 291 end; 292 292 293 function Explode(Separator: char; Data: string): TArrayOfString; 294 begin 295 Result := nil; 296 SetLength(Result, 0); 297 while Pos(Separator, Data) > 0 do begin 298 SetLength(Result, Length(Result) + 1); 299 Result[High(Result)] := Copy(Data, 1, Pos(Separator, Data) - 1); 300 Delete(Data, 1, Pos(Separator, Data)); 301 end; 293 function Explode(Separator: Char; Data: string): TStringArray; 294 var 295 Index: Integer; 296 begin 297 Result := Default(TStringArray); 298 repeat 299 Index := Pos(Separator, Data); 300 if Index > 0 then begin 301 SetLength(Result, Length(Result) + 1); 302 Result[High(Result)] := Copy(Data, 1, Index - 1); 303 Delete(Data, 1, Index); 304 end else Break; 305 until False; 302 306 SetLength(Result, Length(Result) + 1); 303 307 Result[High(Result)] := Data; … … 509 513 end; 510 514 511 function MergeArray(A, B: array of string): T ArrayOfString;512 var 513 I: Integer; 514 begin 515 Result := Default(T ArrayOfString);515 function MergeArray(A, B: array of string): TStringArray; 516 var 517 I: Integer; 518 begin 519 Result := Default(TStringArray); 516 520 SetLength(Result, Length(A) + Length(B)); 517 521 for I := 0 to Length(A) - 1 do
Note:
See TracChangeset
for help on using the changeset viewer.