Function String Lists Class

StringSegmentsToVariantVector

Copy each of the sub-string segments of vFm into an element of the array rTo. Function returns True upon success and false upon failure.

Signature (Visual Basic / VBA)

Public Function StringSegmentsToVariantVector( _
      ByRef rTo() As Variant _
    , ByVal vFm As Variant _
    , ByVal vSegmentLength As Variant _
    ) As Boolean

Code Example

    Assuming
       Dim S As String
       S = "Ariz  Calif Nev   Ore   Wash  "
       Dim V() as Variant
    for example
       StringSegmentsToVariantVector(V(), S, 6) = True
    leaves
       LBound(V) = 0
       UBound(V) = 5
       V(0) = Empty
       V(1) = "Ariz  "
       V(2) = "Calif "
       V(3) = "Nev   "
       V(4) = "Ore   "
       V(5) = "Wash  "

Parameters

Parameter Description
rTo Dynamic array of Variants whose elements each receive one of the string segments. Array rTo is always reinitialized with a lower bound of 0 (zero) and an upper bound of the number of sub-string segments.
vFm String containing the equal-length segments which are to be copied into the array. Function returns False if vFm is Null or cannot be fixed up to a String.
vSegmentLength The length of each sub-string segment within string vFm. Function returns False if vSegmentLength is Null or cannot be fixed up to a number.

Notes & Version History

Note Function will return True and leave rTo initialized from 0 to 0 if vFm is an empty string.