Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to check a small text into a string?
#1
Not Solved
Hi everybody,

I have to present about QTP, I have a big problem when i verified a small text that exist in a string.

For example: I want to check the word "test" exists in the string "test is a job that we have to check error or bug from a product...."

Please help me to verify it. I don't know how to write an action to check this verify point.

Thank you so much
Reply
#2
Not Solved
Hi,
Try Instr command.

Returns the position of the first occurrence of one string within another.
InStr([start, ]string1, string2[, compare])
Reply
#3
Not Solved
Here is the code..

Code:
str = "test is a job that we have to check error or bug from a product...."

s = InStr(1,str,"test")

If s = 1 then
  Msgbox "Given word exists in the string"
else
  Msgbox "Given word does not exists in the string"
End If
Reply
#4
Not Solved
What about if you wanted to check a word's existence in multiple text strings, or maybe the text string is altered. Is there a way to have it check for the word more dynamically or less exact?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  VB Script to separate upper & small Letters from a string and store in excel pradeep537 1 2,074 08-05-2016, 12:26 AM
Last Post: Ankur
  Need to Validate Text filed is blank after clicking on the Text box balak89 3 4,543 09-13-2015, 12:06 AM
Last Post: ADITI1992
  How to retrieve specied string from text file nsuresh316 1 2,200 06-09-2015, 12:24 AM
Last Post: nsuresh316
  Replace a string in a word document with another string rekha.naik 8 14,988 11-14-2013, 12:58 PM
Last Post: pranikgarg
  I am trying to extract text from a webelement but it is generating blank text scenari excellentpawan 2 4,288 08-13-2013, 08:37 PM
Last Post: excellentpawan

Forum Jump:


Users browsing this thread: 1 Guest(s)