Public Function ReplaceStringOnce( _ ByVal vLine As Variant _ , ByVal vFind As Variant _ , Optional ByVal vReplace As Variant _ , Optional ByVal vCompare As Variant _ ) As Variant
ReplaceStringOnce("This is a test.", "s", "$") = "Thi$ is a test."See also:
Replace Function (Visual Basic) ReplaceString Function ReplaceStringNTimes FunctionvLine: The string in which at most one occurrence of vFind is to be replaced with vReplace. Function returns Null if vLine is Null or cannot be fixed up to a String (Behavior #1).
vFind: The string which is to be replaced with vReplace. Function returns Null if vFind is Null or cannot be fixed up to a String (Behavior #2). Function returns vLine unchanged if vFind is an empty string (Behavior #3).
vReplace: The string which is to replace vFind within string vLine. vReplace defaults to an empty string if it is missing or Null or cannot be fixed up to a String (Behavior #4). vReplace can be an empty string in which case the first occurrence of vFind is removed from the string vLine (Behavior #5).
v1.5 Change: Made the vReplace argument optional.
vCompare: Specifies the type of comparison used to determine if strings match (Behavior #6). vCompare defaults to Binary comparisons if it is missing or Null or cannot be fixed up to a number (Behavior #7).
v1.5 Note: This function has been superceded by the Replace function in Visual Basic 6.0. It is similar to the Replace function in Visual Basic, except that this function allows the vFind argument to be Null, in which case it returns Null. Visual Basic's Replace function will generate a runtime error if its Find argument is Null.
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.