File tree 3 files changed +33
-8
lines changed
3 files changed +33
-8
lines changed Original file line number Diff line number Diff line change 21
21
const Count: Integer;
22
22
const EqualityComparer: Generics.Defaults.TEqualityComparison<T>):
23
23
Boolean; static;
24
+ // Creates and returns a new array that is the reverse of the given array.
25
+ class function Reverse<T>(const A: array of T): TArray<T>; static;
24
26
end;
25
27
26
28
class function TArrayUtils.Equal<T>(const Left, Right: array of T;
60
62
Result := A[Pred(Length(A))];
61
63
end;
62
64
65
+ class function TArrayUtils.Reverse<T>(const A: array of T): TArray<T>;
66
+ var
67
+ I: Integer;
68
+ begin
69
+ SetLength(Result, Length(A));
70
+ for I := 0 to High(A) do
71
+ Result[High(A)-I] := A[I];
72
+ end;
73
+
63
74
class function TArrayUtils.SameStart<T>(const Left, Right: array of T;
64
75
const Count: Integer;
65
76
const EqualityComparer: Generics.Defaults.TEqualityComparison<T>): Boolean;
Original file line number Diff line number Diff line change
1
+ function ReverseByteArray(const A: array of Byte): TBytes;
2
+ var
3
+ I: Integer;
4
+ begin
5
+ SetLength(Result, Length(A));
6
+ for I := 0 to High(A) do
7
+ Result[High(A)-I] := A[I];
8
+ end;
Original file line number Diff line number Diff line change @@ -363,13 +363,19 @@ Delphi5=N
363
363
Delphi6 =N
364
364
Delphi7 =N
365
365
Delphi2005Win32 =N
366
- Delphi2006Win32 =Y
366
+ Delphi2006Win32 =N
367
367
Delphi2007 =N
368
- Delphi2009Win32 =Y
369
- Delphi2010 =Y
370
368
DelphiXE =Y
371
- DelphiXE2 =Y
372
- DelphiXE3 =Y
373
- DelphiXE4 =Y
374
- Delphi10S =Y
375
- FPC =N
369
+ Delphi12A =Y
370
+
371
+ [ReverseByteArray]
372
+ Kind =routine
373
+ DisplayName =ReverseByteArray
374
+ DescEx =" <p>Returns a copy of a given byte array with the order of the bytes reversed.</p>"
375
+ Depends =TBytes
376
+ TestInfo =advanced
377
+ AdvancedTest.Level =unit-tests
378
+ AdvancedTest.URL =" https://github.com/delphidabbler/code-snippets/tree/master/tests/Cat-Arrays"
379
+ Snip =656.dat
380
+ DelphiXE =Y
381
+ Delphi12A =Y
You can’t perform that action at this time.
0 commit comments