Is there a function to find the number of occurrences of sub
strings within a string?
Answer Posted / nath t
The below function returns number of occurrences of sub
string within a string
Function SubStrOccur(Str, SubStr)
Occr = split(Str, SubStr)
SubStrOccur = ubound(Occr)
End Function
Scenario 1:
Str = "SairamSairam Sairam"
SubStr = "Sai"
msgbox "Given SubString("&SubStr&") appeared "&SubStrOccur
(Str, SubStr)&" time(s) in given String("&Str&")"
Function return 3 (bcz "Sai" appears 3 times in the given
string.)
Scenario 2:
Str = "SairamSairam Sairam"
SubStr = "sai"
msgbox "Given SubString("&SubStr&") appeared "&SubStrOccur
(Str, SubStr)&" time(s) in given String("&Str&")"
Function return 0 (bcz here "sai" is in small letters
doesn't appear in the given string.)
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
How smart identification works in qtp ?
what is the frame work in J-meter?
What are the types of object repositories? Which one is you are using?
Why script error occur in between recording in qtp?
Where should i find checkpoint and virtual objects's Object properties and values in the QTP 9.2 Means where checkpoints or virtual objects related data will store If i want to get the runtime object properties how can i use Getroproperties on Checkpoints
Can any body please tell me the steps of keyword driven frame work in qtp. My mail is saswat445@gmail.com please send some materials on keyword driven testing in qtp. thanks a lot...
I have qtp 9.5 demo ver,I am not able to record the yahoo broeser.so anyone can tell me what setting i have to do in QTP for yahoo brower recording. why its not recognise the object of yahoo browser????
What are the properties you would use for identifying a browser and page when using descriptive programming?
Can anyone tell me how i used QTP 9.2 use for GIS based S/w with an example?
Hi All, I have QTP installed on my machine but the application under test is on remote machine. I need to automate the scenarios which consist of automatically enter the remote machine through IP address ,record the application in remote machine and run it also when played. Can some one tell how to record the application in remote machine.
How to Get the Run-time value of an object under that web app under Test to the local data table sheet of that Action?
Explain the types of properties that quick test learns while recording?
in a web page How to check and display a particular word from a paragraph?
what is impact analysis on regression testing?
Which functionalities of QTP used in banking project?