Welcome to the new DelphiDabbler Code Library Documentation.

This is a new site that's currently running on alpha code. There are going to be bugs. If you discover any, please report them on the site's issues page (GitHub account required). Thanks.

Warning: Many URLs are going to change. Refer to the README file to discover which library project's documentation has been completed.

Reverse<T> class method

Project: Array Utilities Unit

Unit: DelphiDabbler.Lib.ArrayUtils

Record: TArrayUtils

Applies to: ~>0.1

class procedure Reverse<T>(var A: array of T);
  static;

Description

Reverses the order of elements of a given array.

Parameters:

Example

procedure Reverse_Eg;
var
  A, Expected: TArray<Integer>;
begin
  A := TArray<Integer>.Create(0, 99, 42, 56);
  TArrayUtils.Reverse<Integer>(A);
  Expected := TArray<Integer>.Create(56, 42, 99, 0);
  Assert(TArrayUtils.Equal<Integer>(Expected, A));
end;

See Also