Function String Manipulations Class

RotateString

Rotates the characters within a string after some specified character position.

Signature (Visual Basic / VBA)

Public Function RotateString( _
      ByVal vValue As Variant _
    , ByVal vAfterColumn As Variant _
    ) As Variant

Code Example

    RotateString("1234567890abcdefghij", 10) = "abcdefghij1234567890"
    RotateString("1234567890", 15) = "               1234567890" ' #2
    RotateString("1234567890abcdef", 10) = "abcdef     1234567890" ' #3
    RotateString("123456789", 3) = "456123" ' #4

Parameters

Parameter Description
vValue The string whose characters are to be rotated around some character position vAfterColumn. Function returns Null when vValue is Null or cannot be fixed up to a String.
vAfterColumn The character position after which the string will be rotated, as defined below. Function returns vValue in string form if vAfterColumn is Null or cannot be fixed up to a number. If vAfterColumn is greater than the length of the line, move the whole line after the specified column, as in example #2. If there are fewer characters after vAfterColumn than there are before it, fill the result so that the beginning of vValue appears after vAfterColumn, as in example #3. Characters past position vAfterColumn * 2 are lost, as in example #4.