Function String Manipulations Class

StripLeftNCharacters

Return the string vString with vNumChars characters removed from the left side of it.

Signature (Visual Basic / VBA)

Public Function StripLeftNCharacters( _
      ByVal vString As Variant _
    , ByVal vNumChars As Variant _
    ) As Variant

Code Example

    StripLeftNCharacters("123456789", 3) = "456789"
    StripLeftNCharacters("123456789", 10) = ""
    StripLeftNCharacters("123456789", -5) = "123456789"
    StripLeftNCharacters(12345, 3) = "45"

Parameters

Parameter Description
vString The string whose left-most characters are to be removed. Function returns Null if vString is Null or cannot be fixed up to a String.
vNumChars The number of characters to be removed. Function returns Null if vNumChars is Null or cannot be fixed up to a number. Function returns vString unchanged if vNumChars is <= 0 (less than or equal to zero). Function returns an empty string if vNumChars is greater than length of the string vString.

Notes & Version History

Note Similar to the ShiftStringLeft function, except negative values for vNumChars cause this function to return the entire string, and values of vNumChars greater than the length of vString cause this function to return an empty string.