<-- Previous || Up || Next -->

Reverse Variant Vector Function
Array Manipulations Class

Public Function ReverseVariantVector( _
      ByRef rVector() As Variant _
    , Optional ByVal vMinElem As Variant _
    , Optional ByVal vMaxElem As Variant _
    ) As Boolean

Reverses the elements of a one-dimensional Variant array.
The first element becomes the last, the last becomes the first, etc.
The elements are reversed in place.

Summary:
         rVector
    +----+     +----+
    | 12 | <-- | TX |
    +----+     +----+
    | CA |     | CA |
    +----+     +----+
    | TX |     | 12 |
    +----+     +----+
Example:
    Assuming
       Static avarKeys(0 To 2) As Variant
       avarIn(0) = 12
       avarIn(1) = "CA"
       avarIn(2) = "TX"
    for example
       ReverseVariantVector(avarKeys()) = True
See also:
    ShuffleVariantVector Function
    TranspostVariantMatrix Function
rVector: One-dimensional array of Variant values whose elements' positions will be reversed. rVector must already be dimensioned before it is passed to this function or else an error will occur.
vMinElem: Lower bound for the range of elements that will be reversed. If vMinElem is missing or Null or cannot be fixed-up to a number, it defaults to the current lower bound for the dimension (LBound(rVector)).
vMaxElem: Upper bound for the range of elements that will be reversed. If vMaxElem is missing or Null or cannot be fixed-up to a number, it defaults to the current upper bound for the dimension (UBound(rVector)).
Return value: Function currently returns True in all cases.
v1.2 Change: Changed vMinElem to default to LBound(rVector) instead of 1 (one).
v1.3 BugFix: This Function has been fixed to support the arrays containing elements of Object and DataObject type Values.

Return to ENTISOFT Home Page

Copyright 1999-2005 Entisoft