Function String Lists Class

SortStringSegments

Sort the sub-string segments contained in vString using the sort order/collating sequence vCompare.

Signature (Visual Basic / VBA)

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

Code Example

    SortStringSegments("050102060403", 2, vbBinaryCompare) = "010203040506"
    SortStringSegments("Wa Or nv Ca az ", 3, vbBinaryCompare) = "Ca Or Wa az nv "
    SortStringSegments("Wa Or nv Ca az ", 3, vbTextCompare) = "az Ca nv Or Wa "

Parameters

Parameter Description
vValue String containing the equal-length segments which are to be sorted. Function returns Null if vValue is Null or cannot be fixed up to a String.
vSegmentLength The length of each sub-string segment within string vValue. Function returns Null if vSegmentLength is Null or cannot be fixed up to a number. Function returns Null if the segment length is < 1 (less than one).
vCompare Specifies the sort order/collating sequence. vCompare defaults to Binary comparisons if it is missing or Null or cannot be fixed up to a number.

Notes & Version History

Algorithm Function uses Shell Sort algorithm.