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

Search String Segments Function
String Lists Class

Public Function SearchStringSegments( _
      ByVal vValue As Variant _
    , ByVal vFind As Variant _
    , ByVal vCompare As Variant _
    , ByVal vSegmentLength As Variant _
    ) As Variant

Searches for the string vFind within the string segments contained in vValue.
Function returns the number of the matching segment, or 0 (zero) if no match is found.

    ' Segment #:                 111111222222333333444444555555
    ' Position within Segment:   123456123456123456123456123456
    SearchSortedSegments("Wash  Nev   Ore   Ariz  Calif ", "Calif", vbTextCompare, 6) = 5
    SearchSortedSegments("WANVORAZCA", "NV", vbTextCompare, 2) = 2
    SearchSortedSegments("WANVORAZCA", "AN", vbTextCompare, 2) = 0
Similar to SearchSortedStringSegments except that the segments do not need to be sorted for use with this function.
See also:
    StringSegmentXOfLengthY function
    SearchSortedStringSegments Function
vValue: String containing the equal-length segments which are to be searched for the string vFind. Function returns Null if vValue is Null or cannot be fixed up to a String.
Note: This function uses a linear search algorithm so the segments need not be in sorted order for the function to work properly.

vFind: String which is to be searched for within the sub-string segments of vValue. Function returns Null if vFind is Null or cannot be fixed up to a String.

vCompare: Specifies the type of comparison used to determine if strings match. vCompare defaults to Binary comparisons if it is missing or Null or cannot be fixed up to a number.

vSegmentLength: The length of each sub-string segment within string vValue. Function returns Null if vSegmentLength is Null or cannot be fixed up to a number.

Function returns Null if the segment length is < 1 (less than one).

Note: For a match to occur, the find string vFind must match the RTrim$() of the sub-string segment--trailing spaces are ignored.

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.