Is there a function to find the number of occurrences of sub
strings within a string?
Answer / 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 |
What is Descriptive Programing? In which cases, we will go for descriptive programing?
Does Low-level recording capture mouse movements?
How to switch between browser tabs? )moving from one tab to another tab)
what is the silent mode in WR?
what is mean by soi in object identification
How can you identify the browser and its information using the qtp script?
Is the qtp course will help to create a virtual object?
how can you describe the basic flow of automation with conditional and programmatic logic?
Explain the views in the QTP GUI?
what is the extension for the test version of the script?
In web page there is five OK buttons available, while recording i click on 3rd OK button, How QTP identify the 3rd OK button while running script? Is qtp identify 3rd ok button?
How do we retrieve the content from a text box in a web page