ReplaceInString Method

Replaces a match occurrence in one string with another string.

Syntax

object.ReplaceInString pbstrTargetString, bstrReplacementString, bstrMarkedMatchString, lFirstChar, lCharCount, lFlags, pbstrResultString, pbSuccess

Properties

The ReplaceInString method syntax has these parts:

Part

Description

object

An object expression that evaluates to an object in the Applies To list.

pbstrTargetString

String. Target string to which the replacement is to be made.

bstrReplacementString

String. String to be substituted for the sub-string identified by lFirstChar and lCharCount in the target string.

bstrMarkedMatchString

String. String returned from a previous FindInString method call.

lFirstChar

Long. One-based index of the first character to be replaced in the target string returned from a previous FindInString method call.

lCharCount

Long. Number of characters to be replaced in the target string returned from a previous FindInString method call.

lFlags

Long. Search modifiers.
Valid entries:
0-15 in any of the following combinations:
0 – No modifiers
1 – Match Case
2 – Whole Word Only
4 – Data Source Only
8 – Include Scripts

pbstrResultString

String. Returns the new string with the specified replacement.

pbSuccess

Boolean. Returns True if the operation succeeded, False otherwise.

Remarks

Calling ReplaceInString after calling FindInString produces the same result as calling the FindReplaceInString method.

 

Example

Applies To