Dim Str
Dim SearchStr
Dim Cnt
Dim Str1
Cnt =0
Str=Inputbox("Enter any sentense only alphabets")
SearchStr = Inputbox("Enter Search String")
For i=1 to len(Str)
Str1=mid(Str,i,1)
if trim(ucase(Str1))= trim(ucase(SearchStr)) Then
Cnt=Cnt+1
End if
Next
msgbox "The given character found : "& Cnt & " : Times"
Guru..can you also tell me the code how to find repeated letter from given word using qtp code..
ReplyDeletethank you
7.To find number of repeatable words in the string
Deletetxt = "this is guru prasad kollu"
cnt = 0
For i = 1 to len(txt)
if mid(txt,i,len("is")) = "is" then
cnt = cnt+1
End If
next
msgbox cnt
8.Another model
txt = "this is guruprasad"
cnt = 0
P=1
while instr (P,txt,"is") >0
cnt = cnt+1
p= instr (P,txt,"is") +len("is")
msgbox cnt
End If
if cnt = 1 then
msgbox i
End If
next