Sub String Manipulations Class

StrDel

"String Delete" Remove some number of characters from a string starting at a specific position and going forward.

Signature (Visual Basic / VBA)

Public Sub StrDel( _
      ByRef rString As Variant _
    , Optional ByVal vStartPos As Variant _
    , Optional ByVal vLength As Variant _
    )

Code Example

    Assuming
       Dim S As String
       S = "123456789"
    for example
       StrDel S, 4, 3
    leaves
       S = "123789"

Parameters

Parameter Description
rString The String or Variant from which a sub-string will be removed. Subroutine does nothing if rString is Null or cannot be fixed up to a String.
vStartPos The position of the first character that will be removed from rString. vStartPos defaults to 1 (the first character in rString) if it is missing, Null, cannot be fixed up to a number, or less than 1 (one). Subroutine does nothing (except fixing-up non-string rString arguments to strings) if vStartPos is greater than the length of rString.
vLength The number of characters that will be removed from rString. vLength defaults to 1 (one) if it is missing or Null or cannot be fixed up to a number. Subroutine does nothing (except fixing-up non-string rString arguments to strings) if vLength is <= 0 (less than or equal to zero).