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

Separate Characters Into N Groups Function
String Manipulations Class

Public Function SeparateCharactersIntoNGroups( _
      ByVal vString As Variant _
    , ByVal vStep As Variant _
    , Optional ByVal vSeparator As Variant _
    ) As Variant

Forms the characters of vString into separate groups (lines, words, etc.), with the 1st character going into the 1st position in line #1, the 2nd character going into the 1st position in line #2, the 3rd character going into the 2nd position in line #1, etc.
Similar to the StringEveryNthCharRepeated function.

Example:
       ? SeparateCharactersIntoNGroups("1234567890ABCDEFGHIJ", 3)
       1470CFI
       258ADG
       369BEH
    that is
       "1470CFI" + vbCrLf + "258ADG" + vbCrLf + "369BEH"
See also:
    AddCrLfEveryNCharacters Function
    WrapText Function
    WrapBlocks Function
vString: The string whose characters are to be rearranged. Function returns Null if vString is Null or cannot be fixed up to a String.

vStep: The maximum number of lines within the result string, vStep defaults to 1 (one) if it is Null, cannot be fixed up to a number, or is less than or equal to 0 (zero). If vStep happens to be greater than the length of vString then the returned string will have a carriage return and line feed pair at the end of it.

vSeparator: The string that will separate the groups of characters in the result. vSeparator defaults to carriage-return line-feed (vbCrLf) if it is missing or Null or cannot be fixed up to a String.

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