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

Can any one tell me about "Mapping Repository Parameter Values" and why we use it....??How to use it???Please, tell the preconditions also...........???? Thanks in Advance

0 Answers  


Hi! Using Descriptive Programming How do we get Parent object for an object. Say, i want to get a parent object for a "Link" in a web page. thanks

3 Answers  


Can we record a video in qtp recording??

1 Answers   BirlaSoft,


how can i prepare for QTP(8.2) to face interview ? give over view details?

52 Answers  


How to give Table check points?

4 Answers   ssinformatics,


How u send bugs to dev'lpment team all at once or one by one or waht is the process?

2 Answers   kenexa,


what is the frame work in J-meter?

0 Answers  


Is it possible to use two instances of UFT on the same machine? If not why?

0 Answers  


how to identify the user defind varibles? plz tell me

1 Answers  


where we save the scripts created in one project?

6 Answers   IBM,


your coming from electrical backgroung..but y ur coming to software side?

0 Answers   Accenture,


What is Unicode Compatibility?

0 Answers   HCL,


Categories