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

Difference String Function
String Manipulations Class

Public Function DifferenceString( _
      ByVal vStringOne As Variant _
    , ByVal vStringTwo As Variant _
    , Optional ByVal vCompare As Variant _
    , Optional ByVal vIfSame As Variant _
    , Optional ByVal vIfDiff As Variant _
    ) As Variant

Returns a string with different characters describing the matching and non-matching portions of the two strings.
The character at a specific position within the returned string describes whether characters at the same corresponding positions within vStringOne and vStringTwo match each other.

Example:
    DifferenceString("ABCDEF", "123DEF", vbBinaryCompare, "|", " ") = "   |||"
See also:
    CompareStrings Function
    ContrastStrings Function
vStringOne: One of the strings which is to be compared and contrasted 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 and contrasted 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.

vIfSame: Character used to indicate that the corresponding characters match. Note: Special argument fix-up code.

If vIfSame is an empty string, then matches are indicated with a space (" ") character.

If vIfSame is a non-empty string, then matches are indicated using its first character.

If vIfSame is numeric (and not a numeric string), then matches are indicated using the character with the specified ASCII value.

If vIfSame is missing or Null then matches are indicated with a space (" ") character.

vIfDiff: Character used to indicate that the corresponding characters do NOT match. Note: Special argument fix-up code.

If vIfDiff is an empty string, then non-matches are indicated with a space (" ") character.

If vIfDiff is a non-empty string, then non-matches are indicated using its first character.

If vIfDiff is numeric (and not a numeric string), then non-matches are indicated using the character with the specified ASCII value.

If vIfDiff is missing or Null then non-matches are indicated with a space (" ") character.

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