Function Character Arrays Class

SortUsedCharacters

Return a string containing each of the unique characters present in the input string. Characters are returned in sorted order, and each character will appear at most once. This function uses Binary sorting order, because of the algorithm.

Signature (Visual Basic / VBA)

Public Function SortUsedCharacters( _
    ByVal vValue As Variant _
    ) As Variant

Code Example

    SortUsedCharacters("cbaABCCBA") = "ABCabc"
    SortUsedCharacters("CBACBA") = "ABC"

Parameters

Parameter Description
vValue String containing the characters which are to be sorted based upon their ASCII values. Function returns Null if vValue is Null or cannot be fixed up to a String.

Notes & Version History

Algotithm This algorithm sorts the characters through distribution counting.
Note Function uses the ASCII value of characters to determine if they match, which is in effect the same as using Binary comparisons.
Note Function currently only works for characters whose ASCII value is between 0 and 255, so it does NOT support UNICODE.