Function String Manipulations Class

DeleteString

Returns the string vString with a portion of the string removed. Removes the portion of vString beginning at character position vStartPos with a length of vLength.

Signature (Visual Basic / VBA)

Public Function DeleteString( _
      ByVal vString As Variant _
    , Optional ByVal vStartPos As Variant _
    , Optional ByVal vLength As Variant _
    ) As Variant

Code Example

     DeleteString("ABCDEFGHIJ", 3, 4) = "ABGHIJ"

Parameters

Parameter Description
vString The string from which a portion (a sub-string) is to be removed. Function returns Null if vString is Null or cannot be fixed up to a String.
vStartPos The position of within vString of the first character to be removed. vStartPos defaults to 1 (one) if it is missing or Null or cannot be fixed up to a number. vStartPos is set to the beginning of the string if it is less than 1 (one). vString is returned unchanged if vStartPos is beyond the end of vString.
vLength The number of characters to be removed from vString. vLength defaults to 1 (one) if it is missing or Null or cannot be fixed up to a number. vString is returned unchanged if vLength is <= 0 (less than or equal to zero).

Notes & Version History

Details which is "ABCDEFGHIJ" with four (4) characters removed ("CDEF") starting at the third (3) character.