Function Character Arrays Class

IntersectCharacters

Return a string containing the characters that two strings have in common. Each unique character which appears in both vStringOne and vStringTwo will appear once within the result string. Relational intersect operation on the characters in a string.

Signature (Visual Basic / VBA)

Public Function IntersectCharacters( _
      ByVal vStringOne As Variant _
    , ByVal vStringTwo As Variant _
    ) As Variant

Code Example

    IntersectCharacters("ABBCCCDDDD", "FFEEDDCC") = "CD"
    IntersectCharacters("ABCABC", "123") = ""

Parameters

Parameter Description
vStringOne First of the two string from which the unique common characters will be copied into the result string. Function returns Null if vStringOne is Null or cannot be fixed up to a String.
vStringTwo Second of the two string from which the unique common characters will be copied into the result string. Function returns Null if vStringTwo is Null or cannot be fixed up to a String.

Notes & Version History

Note Function uses the ASCII value of characters to determine if they match, which is in effect the same as using Binary comparisons.