how to calculate no. of repeating characters in a a
string..please give me the code

Answers were Sorted based on User's Feedback



how to calculate no. of repeating characters in a a string..please give me the code..

Answer / sandeeo

A="God is Great"
Cnt=split(A,"G")
msgbox Ubound(Cnt+1)

Is This Answer Correct ?    0 Yes 1 No

how to calculate no. of repeating characters in a a string..please give me the code..

Answer / venky

mystring = "mississipi"
slen=Len(mystring)
msgbox slen
ws=Len(replace(Mystring,"s",""))
msgbox ws
charcount=Len(mystring)-Len(replace(Mystring,"s",""))
msgbox charcount

Is This Answer Correct ?    1 Yes 3 No

how to calculate no. of repeating characters in a a string..please give me the code..

Answer / devi

The above script is correct. Apart from that script i have
one more script for finding no. of repeated characters in a
string

Suppose we have to know how many "s" are there in mississipi

code follows:

mystring = "mississipi"
charcount=len(mystring)-len(replace("s",""))
msgbox charcount

then output is : 4

Is This Answer Correct ?    6 Yes 11 No

how to calculate no. of repeating characters in a a string..please give me the code..

Answer / devi

in above some mistake is there

sorry for that

charcount=len(mystring)-len(mystring,replace("s",""))

this is the correct one

Is This Answer Correct ?    2 Yes 10 No

Post New Answer

More QTP Interview Questions

How to find if given number is prime or not

1 Answers  


Explain the Different types of QTP test assets and their extensions?

0 Answers  


Shall we add Local Repository to shared object repository,if yes,how we add

4 Answers  


I am using DataTable.ImportSheet method to import the data from an excel sheet to the Runtime DataTable of QTP. here is my piece of code DataTable.import("c:\DataSheet.xls","Members","Members") The first row headings of Members sheet of DataSheet.xls and Members sheet of QTp are matched. but the QTP is taking very long time(approximately half an hour) to import the data into runtime datatable even though the DataSheet.xls has one or two rows in it. Please let me know why this is happening and is there any alternative for impoting the data into runtime datatable of qtp ?

2 Answers  


how do u get lib files into scripting files?

4 Answers  






What is InStr()

6 Answers   Kanbay,


What will be the output of the statements below? On error Resume Next Sum 100/0 if Sum= 0 Then msgbox "Pass" else msgbox "Fail" End If

3 Answers   IIT,


RECENTLY I PLACED IN QTP..HOW TO IMPROVE VB SCRIPTS KNOWLEDGE? IAM STRUGGING TO WRITE THE AUTOMATION SCRIPTS? ANY BODY TELL HOW TO IMPROVE QTP SCRIPT SKILLS?

0 Answers  


can anyone tell me what to say in interview when interviewer asks about "tell me about your framework in your project"?

0 Answers  


i want know iam working 2+ exp in QTP can i do performence testing (eg:loadrunner) yes r no?

6 Answers   IBM,


what is the use of descriptive programming in QTP ? when we need to use DP? can we test the application completely with out useing DP?? please explan with example

2 Answers  


How does u create new test sets in TD?

1 Answers   Crea,


Categories