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...


Please let know the scripts for counting number of repeated
letters in the word. Note repeated letter should not be
count agian.

Ex: If "Hello" is my word... l is coming twice.. it should
count once and print... secong 'l' should not count again..

Answers were Sorted based on User's Feedback



Please let know the scripts for counting number of repeated letters in the word. Note repeated lett..

Answer / vishala

An optimised code with one loop:

strsting = "HelLo"
strnew = ""
For i = 1 To Len(strsting)
If InStr(1, strnew, Mid(strsting, i, 1), vbTextCompare) = 0 Then
strnew = Mid(strsting, i, 1) & strnew
strarr = Split(strsting, Mid(strsting, i, 1), -1, vbTextCompare)
If UBound(strarr) > 1 Then
MsgBox Mid(strsting, i, 1) & " is repeated " & _
UBound(strarr) & "times"
End If
End If
Next

Is This Answer Correct ?    5 Yes 0 No

Please let know the scripts for counting number of repeated letters in the word. Note repeated lett..

Answer / chaitanya

Option Explicit
Dim st,cnt,str,i,j
str = "happy"
For i=1 to len(str)
cnt =0
st = mid(str,i,1)
For j=1 to len(str)
If mid(str,j,1)=st Then
cnt =cnt +1
End If
Next
If cnt>1Then
msgbox st & " repeats " & cnt & "times"
End If
Next

Is This Answer Correct ?    2 Yes 1 No

Please let know the scripts for counting number of repeated letters in the word. Note repeated lett..

Answer / mahesh.k

str=inputbox("enter a string")
ln=len(str)
nr=0
cnt=0
For i=1 to ln
If cnt>0 Then
nr=nr+1
End If
cnt=0
If strcomp(x,mid(str,i,1))<>0 Then
For j=i+1 to ln
If mid(str,i,1)=mid(str,j,1) then
cnt=cnt+1
x=mid(str,i,1)
end if
next
else
i=i+1

End If
Next
msgbox "no.of repeeted charecters="&nr

Is This Answer Correct ?    0 Yes 0 No

Please let know the scripts for counting number of repeated letters in the word. Note repeated lett..

Answer / sunil

A="Hello"
Set rxp = New RegExp
With rxp
.Global = True
.IgnoreCase = True
.Pattern ="l"
End With

Set colMatch = rxp.Execute(A)

msgbox colMatch.count

Is This Answer Correct ?    2 Yes 2 No

Please let know the scripts for counting number of repeated letters in the word. Note repeated lett..

Answer / pvr

Dim str,ln,i,md,ub,sp
str="apple"
ln=len(str)
for i=1 to ln
md=mid(str,i,1)
sp=split(str,md)
ub=ubound(sp)
if ub=i+1 then
msgbox md &vbnewline& "contain more than one character in
given string"
else
msgbox md &vbnewline& "contain only one character in given
string"
end if
next

If any modifications are there please let me know....

Is This Answer Correct ?    1 Yes 2 No

Post New Answer

More QTP Interview Questions

A dialog is diplays " Transaction 254689 has been successfully completed" How to get the transaction ID from the message ?

6 Answers   Virtusa,


Suppose i have given 10 test cases all the test cases should be automated?

3 Answers   NTT Data,


Which Databases supports for QTP?

3 Answers   CTS,


hai, i am doing QTP by own. So, i am confident in checkpts,synchronization, data driven test, recovery scenarioe manager etc. but actually i don't know how all these we wil implement while we r writting code manually. when we r doing practice, while recording code is automatically generated but in real time i heard that we have to write the script.But i don't know how it is? How to write descriptive prog.? plz. tel me what r the basic things we have to know? explain how to write descriptive prog.? explain me with an example pls.......

2 Answers   Vertex,


Is it possible to switch between recording modes during a test creation?

0 Answers  


For which type of projects the iterative model is not suitable?

0 Answers  


What is the main difference between QTP 8.0& QTP 9.2.And what r the features and benefits of QTP.

1 Answers   HCL,


tell me QTP standards ?plz

0 Answers   Kanbay,


Hi Guys, My Application in Microsoft Dynamic Navision, is it compitibale with QTP? if yes then let me know...

0 Answers  


What r steps to migrate from Manual testing to QTP?(IN BOTH WEB BASED AND WINDOWS APP)

1 Answers   Wipro,


What are default add-ins in qtp?

14 Answers   Semantic Space,


How to call a function in QTP?Is there any method ? Thanks , PRASANNA

2 Answers  


Categories