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
Define Error Pane of UFT?
What is QTP’s model for test creation?
How to remove the associated function library?
What are the different recording modes and how do they work?
How can we extract data like "Details","Result","Time" from the 'Run Error' result generated in QTP after run time errors are generated during a run & import the details etc...into excel sheet
Is text area check point supports for web applications?
I recorded a Web App with a Oracle backend using QTP 9.5 and for some reason the scripts don't play back> What am I missing at this point. I recorded the same Apps under Sybase and they work great. This is Oracle 10g. Why won't my scripts play back.
How you can find the absolute value of the number in qtp?
can u please explain what is the exact difference between qtp8.2 and 9.0
How may types of defects identify application or your currently working application?pls give me answer..
What is difference in global and action sheet in qtp?
How do know the number of browsers opened?
What are the features and benefits of quick test pro (qtp 8.0)?
What is the limitation to XML Checkpoints?
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????