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

Compare Strings Function
String Manipulations Class

Public Function CompareStrings( _
      ByVal vStringOne As Variant _
    , ByVal vStringTwo As Variant _
    , Optional ByVal vCompare As Variant _
    ) As Variant

Indicate which portions of two strings are the same.
Includes the original strings and the marker string all separated by carriage return and line feed characters.
Indicates matches with a caret character ("^") in the marker string and indicates differences with a space (" ").

Summary: Similar to the ContrastStrings function except that the characters used to indicate matches are reversed. Relies upon the DifferenceString function to generate the "marker" string.
Example:
       ? CompareStrings("ABCDEFGHI", "ABCFEDGHI")
       ABCDEFGHI
       ABCFEDGHI
       ^^^ ^ ^^^
    that is
       "ABCDEFGHI" + vbCrLf + "ABCFEDGHI" + vbCrLf + "^^^ ^ ^^^"
    or
       "ABCDEFGHI" + Chr$(13) + Chr$(10) + "ABCFEDGHI" + Chr$(13) + Chr$(10) + "^^^ ^ ^^^"
See also:
    ContrastStrings Function
    DifferenceString Function
vStringOne: One of the strings which is to be compared with the other. Function returns Null if vStringOne is Null or cannot be fixed up to a String.

vStringTwo: One of the strings which is to be compared with the other. Function returns Null if vStringTwo is Null or cannot be fixed up to a String.

vCompare: specifies the type of string comparison used to determine whether corresponding characters match. vCompare defaults to Binary comparisons if it is missing or Null or cannot be fixed up to a number.

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