Tuesday, 13 May 2014

QTP-UFT-Can you check if a value is present in a string or not

Yes , We can use Instr method

Example:-
ReturnValue= Instr(1,"UFTQuestions","Questions")
Return 0 if the string is not found other wise returns the starting Position at which match is found

In our case

ReturnValue will return 4

To check it run the below code in QTP/UFT

Syntax
ReturnValue= Instr(1,"UFTQuestions","Questions")
Msgbox ReturnValue


No comments:

Post a Comment