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

Sort Characters Function
Character Arrays Class

Public Function SortCharacters( _
      ByVal vValue As Variant _
    , Optional ByVal vCompare As Variant _
    ) As Variant

Sorts the characters in a string using some specific collating sequence.
Result string will contain all of the characters from string vValue, NOT just the unique ones.
Usually slower than the SortCharactersBinary function which sorts based on the ASCII value of each character.

Examples:
    SortCharacters("cbaABCCBA", vbBinaryCompare) = "AABBCCabc"
    SortCharacters("cbaABCCBA", vbTextCompare) = "AAaBBbCCc"
    SortCharacters("cbaABCCBA", dbSortDutch) = "AABBCCabc"
See also:
    SortCharactersBinary Function
    SortCharactersIndirect Function
    SortCharactersByFrequency Function
    SortUsedCharacters Function
    SortCharactersBenchmark Subroutine
    IsStringSorted Function
    IsAnagram Function
Note that the dbSort... Constants are defined by Visual Basic or Microsoft Access. You can pass the value of these constants from within other contexts where those constants are not available.

vValue: String containing the characters which are to be sorted using a specific sort order/collating sequence. Function returns Null if vValue is Null or cannot be fixed up to a String.

vCompare: specifies the sort order/collating sequence by which the characters should be sorted. vCompare defaults to Binary comparisons (sort order based upon ASCII value of characters) if it is missing or Null or cannot be fixed up to a number.

Algotithm: This function currently uses a Shell Sort.
Note: Characters which have different ASCII values but do match each other within the specified collating sequence are returned in order by their ASCII value.

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