Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Is there a function to find the number of occurrences of sub
strings within a string?



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

Post New Answer

More QTP Interview Questions

What type of VB script u had done in expert view?

1 Answers   HCL,


Did the scripts need lot of maintenance? If yes, why?

0 Answers  


Explain advantages and disadvantages of ddf?

0 Answers  


what is vmodel?advantages and disadvantages of vmodel?

0 Answers   AZTEC,


Hi Friends,will any body tell to Me for which Auomation Tool their is great Requirement inht eMarket Eithr the QTP or WINRUNNER and for what reason and how long it is going to remain and wat the Scope for the automation Testing In the Future Please tll to Me In Details Ok .

2 Answers  


I have 5 no.of Action in my Test. Out off which i should make 3rd action as my start-up action. How should i make it?

9 Answers   IBM,


What are the details steps to connect a remote mysql database in QTP

1 Answers   Verizon,


How to handle the exceptions using recovery scenario manager in QTP?

0 Answers   Crea, CTS,


Explain the concept of object repository and how quicktest professional (qtp) recognises objects?

0 Answers  


Can the user toggle between using Local OR and shared OR for the same action?

0 Answers  


How to Set the Global Sync Timeouts in QTP?

2 Answers  


For QTP Test Engineer, What is his contribution to the Project? Means, As as automation test engineer what is his role in the current project?

0 Answers   V2 Solutions,


Categories