How to find and replace a word in a delimited string

  • Questions
  • How to find and replace a word in a delimited string
Question ID: 106561
0
0

How can I find and replace a word in a string in a UFT GUI?

Marked as spam
Posted by (Questions: 45, Answers: 1)
Asked on December 31, 2015 4:55 pm
2 views
Answers
0
Private answer

Searching for a word in a string and replacing it
Here is an example on how to search for a word in a string and replace it. In the example, the word ''and'' will be replaced with ''or.''
Example:

strFinal=''''
strA =''directory of travelogues, travel tips and classifieds, and destination information.''
MsgBox(strA)
myArray=split(strA, '' '')
For i=0 To UBound(myArray)
If strcomp(myArray(i),''and'',1 ) Then
Else
myArray(i)=''or''
End If
strFinal=strFinal & myArray(i) & '' ''
Next
MsgBox(strFinal)

Marked as spam
Posted by (Questions: 2, Answers: 98)
Answered on December 31, 2015 4:57 pm