ReplaceInString Method Example

The following example finds each occurrence of the string AI1 with the string FIX32.NODE1.AI1.F_CV by calling FindInString and then uses the lFirst, lCount parameter return values to replace AI1 with AI2, returning the new string in the sReplacement parameter. The operation is specified to include scripts in the search.

Dim lFirst As Long

Dim lCount As Long

Dim sMatchString As String

Dim bFound As Boolean

Dim bsuccess As Boolean

Dim sTarget As String

Dim sReplacement As String

sTarget = "FIX32.NODE1.AI1.F_CV"

FindReplace.FindInString "FIX32.NODE1.AI1.F_CV", 1, "AI1", 8, sMatchString, lFirst, lCount, bFound

FindReplace.ReplaceInString sTarget, "AI2", sMatchString, lFirst, lCount, 8, sReplacement, bsuccess