<-- Previous || Up || Next -->

Insert String Function
String Manipulations Class

Public Function InsertString( _
      ByVal vDest As Variant _
    , ByVal vSource As Variant _
    , Optional ByVal vInsertPosition As Variant _
    ) As Variant

Insert one string into the middle of another string and return the results.
vSource is inserted into vDest before character position vInsertPosition.

Summary: Similar to the StrIns subroutine, except that this is a function which returns the result instead of modifying an argument.
Example:
    InsertString("123456", "NEW", 3) = "12NEW3456"
See also:
    OverlayString Function
    DeleteString Function
    StrIns Subroutine
Function returns Null if both strings (vDest and vSource) are Null.

vDest: The string into which the other string is to be inserted. vDest defaults to an empty string if it is Null or cannot be fixed up to a String.

vSource: The string which is to be inserted into the other string. vSource defaults to an empty string if it is Null or cannot be fixed up to a String.

vInsertPosition: The character position within vDest before which vSource will be inserted. vInsertPosition defaults to 1 (one) if missing or Null or cannot be fixed up to a number.

vSource is inserted at the beginning of vDest if vInsertPosition is < 1 (less than one).

vSource is inserted after the end of vDest if vInsertPosition is greater than the length of vDest.

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.