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
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 |
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 |
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 |
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 |
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 |
What r the features of QTP9.2,other than QTP8.0 What r the extre features of QTP9.2.
I want to know how to execute the descriptive programming in qtp for the webedit object which does not contain attached text property. but i have checked it with name and html id property. Even though it is not executing. it is giving error in object's physical description.
Can anyone pls tell me how to do action parameterization (input and output parameters) with respect to login window and insert order of flight reservation window in detail( pls give a clear step by step explanation with example) anyone please. Will be very thankful to u
Hello Everybody, Can anyone tell me that in QTP how to count the number of webelements from the object repository. Please provide the code. Thanks in advance, Gaytri
Write a script to customize the test results in PDF and HTML format.
tell me about framework types and most used framework in real time. types of output value in details. diff between wr and qtp in detail.
how we connect oracle or sql data server database to qtp. Hi Ram I was your answer for this. Can you kindly let me know in details steps on How we can connect to database. i am using QTP9.2 and SQL Server Database. I am new for QTP and this would be of great help.Thanks
hi everybody this questions is only for qtp real time users. anyone please clearly explain the approach u r following for qtp testing in ur company or qtp framework u r following in ur company pelase give me clear explanation then u did great favour to inexeprienced qtp users
where we save the scripts created in one project?
What is the Difference between Environment variable and Globle variable,.. anybody can give me answer..Thanks in advance...
How can we extract data like "Details","Result","Time" from the 'Run Error' result generated in QTP after run time errors are generated during a run & import the details etc...into excel sheet
What is driver script and driver script in qtp frame work????