Micro Focus QTP (UFT) Forums
Finding specific text in a text string - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Finding specific text in a text string (/Thread-Finding-specific-text-in-a-text-string)



Finding specific text in a text string - janriis - 10-08-2010

Hi all

How can I, by using descriptive programming, find a specific text in a text string ?

Example: I want to check if the word "descriptive" exists in the sentence above.

Thanks


RE: Finding specific text in a text string - Saket - 10-08-2010

use Instr


RE: Finding specific text in a text string - janriis - 10-08-2010

Could you give me an example of the syntax please.

Thx


RE: Finding specific text in a text string - KavitaPriyaCR - 10-08-2010

text1="How can I, by using descriptive programming, find a specific text in a text string ?"
'InStr Returns the position where text is located in main string else returns 0
Code:
If (InStr(text1,"descriptive")<>0) Then
   MsgBox "Text Found"
else
   MsgBox "Text Not Found"
End If