Function String Searches Class

InStrToVariantVector

"In String To Variant Vector" Creates a list of all of the non-overlapping positions of one string within another string.

Signature (Visual Basic / VBA)

Public Function InStrToVariantVector( _
      ByRef rPositions() As Variant _
    , ByVal vLine As Variant _
    , ByVal vFind As Variant _
    , Optional ByVal vCompare As Variant _
    ) As Boolean

Code Example

    Assuming
       Dim Matches() As Variant
    for example
       InStrToVariantVector(Matches(), "This is a test.", "is")
    leaves
       LBound(Matches) = 0
       UBound(Matches) = 2
       Matches(0) = Empty
       Matches(1) = 3
       Matches(2) = 6

Parameters

Parameter Description
vLine The string which is to be searched from left-to-right for the non-overlapping appearance of string vFind. Function returns False if vLine is Null or cannot be fixed up to a String.
vFind The string which is to be repeatedly searched for within string vLine. Function returns False if vFindChars is Null or cannot be fixed up to a String. Function returns False if vFindChars is an empty string.
vCompare Specifies the type of comparison used to determine if the strings match. vCompare defaults to Binary comparisons if it is missing or Null or cannot be fixed up to a number. Function dimensions rPositions from 0 (zero) to the number of matches found, and stores the first position of each non-overlapping match in one of the elements of rPositions. If the string vFind does not appear within vLine, rPosisions is dimensioned from 0 (zero) to 0 (zero) and the function returns True.