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

Character Positions Array Function
Sort Orders Class

Public Function CharacterPositionsArray( _
      ByRef raintPositions() As Integer _
    , ByVal vString As Variant _
    ) As Boolean

Turn the sort order string into an array where the element number represents the ASCII value of the character, and the value represents the character's sequence within the character set.

Will convert a string like "^D^C^B^A" (where ^A represents Control-A) into an array like: A(0) = 5, A(1) = 4, A(2) = 3, A(3) = 2, A(4) = 1, A(5) = 6, A(6) = 7, etc.
Example:
    Assuming
       Dim aintCustom() As Integer
    for example
       CharacterPositionsArray(aintCustom(), "AaBb") = True
    leaves
       LBound(aintCustom) = 0
       UBound(aintCustom) = 255
       aintCustom(65) = 1
       aintCustom(97) = 2
       aintCustom(66) = 3
       aintCustom(98) = 4
       aintCustom(0) = 5
       aintCustom(1) = 6 'etc.
See also:
    SortOrderString Function, et. al.
raintPositions: Dynamic one-dimensional array of integers which will be filled with the collating sequence for each character. The value of element X will be the collating sequence for the character with ASCII value X.

vString: String containing the characters which define the collating sequence. The position of each character within this string is the position of the character with that ASCII value within the collating sequence. vString defaults to an empty string is it is Null or cannot be fixed up to a String.

Note: Function currently only works for characters whose ASCII value is between 0 and 255, so it does NOT support UNICODE.

Note: Function assigns collating sequences to those characters that did not appear within the string vString. Each of those characters will be added to the end of the collating sequence. They will be added in order by their ASCII value.

Function returns True upon success.

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