Function String Manipulations Class

RotateStringLeft

Rotates the characters within a string to the left by vPositions, taking the first vPositions characters within the string and placing them at the end of the string.

Signature (Visual Basic / VBA)

Public Function RotateStringLeft( _
      ByVal vValue As Variant _
    , Optional ByVal vPositions As Variant _
    ) As Variant

Code Example

    RotateStringLeft("123456789", 3) = "456789123"
    RotateStringLeft("123456789", 12) = "456789123" ' #2
    RotateStringLeft("123456789", -3) = "789123456" ' #3

Parameters

Parameter Description
vValue The string whose characters are to be rotated to the left. Function returns Null if vValue is Null or cannot be fixed up to a String.
vPositions The number of positions that each character is to be rotated. vPositions defaults to 1 (one) if it is missing or Null or cannot be fixed up to a number. vPositions can be greater than the length of the string, as in example #2. vPositions can be negative in which case the string is shifted to the right, as in example #3.