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

Matches In Context Function
String Searches Class

Public Function MatchesInContext( _
      ByVal vSearch As Variant _
    , ByVal vFind As Variant _
    , Optional ByVal vCompare As Variant _
    , Optional ByVal vContextChars As Variant _
    , Optional ByVal vSeparator As Variant _
    ) As Variant

Return a string containing all of the occurrences of vFind within vSearch, and include up to vContextChars characters of the surrounding text on each side of the match.

Example:
    MatchesInContext("This is a test.", "is", 8) = "     This is a te" + vbCrLf + "   This is a test."
See also:
    MatchesInContextSample Subroutine
vSearch: The string which is to be searched for non-overlapping appearances of vFind. Function returns Null if vSearch is Null or cannot be fixed up to a String.

vFind: The string which is to be searched for within string vSearch. Function returns Null if vSearch is Null or cannot be fixed up to a String.

Function returns an empty string if vFind 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.

vContextChars: The number of characters of surrounding context that will be included on each side of each match. vContextChars defaults to 16 if it is missing or Null or cannot be fixed up to a number.

vSeparator: The string used to separate matches within the result string. vSeparator defaults to carriage-return line-feed if it is missing or Null or cannot be fixed up to a String.

Function returns an empty string if the string vFind does not appear anywhere within string vSearch.

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