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

Str Rep Sub
String Replacements Class

Public Sub StrRep( _
      ByRef rLine As Variant _
    , ByVal vFind As Variant _
    , Optional ByVal vReplace As Variant _
    , Optional ByVal vCompare As Variant _
    )

"String Replace"
Replace all non-overlapping occurrences of the vFind in vLine with vReplace.
Similar to the ReplaceString function except that this subroutine modifies its argument instead of returning a result.

Example:
    Assuming
       Dim S As String
       S = "This is a test."
    for example
       StrRep S, "is", "X"
    leaves
       S = "ThX X a test."
See also:
    Replace Function (Visual Basic)
    ReplaceString Function
Note: This function works correctly with vReplace strings that contain the vFind string. For example, Chr$(10) can be replaced by Chr$(10)+Chr$(13) without the function getting into an infinite loop.

rLine: The string in which all occurrences of vFind are to be replaced with vReplace. Subroutine does nothing if rLine is Null or cannot be fixed up to a String.

vFind: The string which is to be replaced with vReplace wherever it appears within string rLine. Subroutine sets rLine to Null then exits if vFind is Null or cannot be fixed up to a String.

Subroutine leaves rLine unchanged if vFind is an empty string.

vReplace: The string which is to replace all occurrences of vFind within string rLine. vReplace defaults to an empty string if it is missing or Null or cannot be fixed up to a String.

vCompare: Specifies the type of comparison used to determine if strings match. vCompare defaults to Binary comparisons if it is missing or Null or cannot be fixed up to a number.

v1.5 Pro Change: The implementation of this function has been changed to use the Replace function in Visual Basic.

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