Function Character Arrays Class

DifferenceCharacters

Return a string containing all of the unique characters in vStringOne which are not in vStringTwo. Each unique character in string vStringOne will appear at most once within the result string. Relational difference operation on characters in a string.

Signature (Visual Basic / VBA)

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

Code Example

    DifferenceCharacters("FFEEDDCCBBAA", "ABBCCC") = "DEF"
    DifferenceCharacters("AABBCC", "") = "ABC"
    DifferenceCharacters(EveryCharacter, "ABBCCC") = CharactersNotInString("ABBCCC")

Parameters

Parameter Description
vStringOne String containing the characters of which the unique ones that do not also appear in vStringTwo will be copied to the result string. Function returns Null if vStringOne is Null or cannot be fixed up to a String.
vStringTwo String containing the characters which will be excluded from the result string. will be copied to the result string. Function returns Null if vStringTwo is Null or cannot be fixed up to a String.

Notes & Version History

Note Similar to the CharactersNotInString function except this function assumes that vStringOne will consists of all of the characters with ASCII values from 0 (zero) through 255.
Note Function uses the ASCII value of characters to determine if they match, which is in effect the same as using Binary comparisons.
Note The characters in the result string are always returned in order by their ASCII value.