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
any body plz send health care domain project to me with explanation any two modules on that project. mail_id: ranjith_99reddy@yahoo.co.in
Could you please any one give code for the following ? Scenario : Suppose a excel file contains 10 records and earch have 5 fields. how can i input this excel file for datadrive wizard ? Please explain
can any one say that where we can download the QTP trail version ??????????
what is the difference between modular framework & datadriven framework
How often were they executed?
what is review
What does it mean when a check point is in red color? What do you do?
How to use the object spy in quicktest professional 8.0 version?
What are the technologies supported by qtp?
suppose in the middle of the project QTP will not work properly, then what do u do? and ur team?
What are the common defects found in your project? (in qtp interview)
I want to do QTP Certification what is the pattern of Question paper.
In qtp, how you can remove the spaces from string?
1.How do u prepare the test suits in QC? 2.How do u convert requirements to test plan in QC?
1. What is the difference between Keyword and function in the keyword driven framework? 2. How do you associate Keywords to the script ?