How can i count "spaces" in any sentence or a string
if suppose " It is a Testing question"
Here we have 4 gaps(spaces)
Is there any function to find out spaces between words

Answer Posted / uma

Test:

str="it is a testing question"
Call spacecount(str,d) /*Function Call*/
msgbox "Number of spaces:" & d

User Defined Function :

Public function spacecount(a,b)
str=a
p=split(str)
coun=0
For i=1 to ubound(p)
coun=coun+1
Next
msgbox coun
b=coun /*Returns Number of spaces to the calling Function /
End Function

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

In qtp, explain what is keyword driven automation framework?

848


What is the extension of QTP local Repository? If it is .mtr then what is .bdb extension stands for?

844


Write a script to verify font style and color of a windows object using descriptive programming

1118


How do you know the location Id of an object if you know its index id?

813


Sql questions to find second max salary and how to use joins

1283


How to test login module with different username and password by using data driven testing in QTP?

852


How to do the scripting. Are there any inbuilt functions in QTP? What is the difference between them? How to handle script issues?

832


Hi Friendss..., can any body help me.. 1. Tell me your achievements(Technically)..? 2. Tell me your strengths(Technically) and weakness(Technical)..? 3. Why are you looking for change..?

1625


Can we run test with out adding object in object repository? How it is possible?

833


when a test case is written how u test using qtp

1905


Hi. please provide license key for QTP 9.2, I have windows XP on my machine Thanks in Advance, moreshwar

3014


What is output value? How many types of output values are there in qtp?

799


In the Hybrid framework, data can access the database, excel file, XML etc. Is it true?

783


HI I want to know the detials of QTP certifications such as syllabus, study Materil etc. Can any provide me all these details?? my mail ID is krishnuvk@yahoo.com

1772


Can we call qtp test from another test using scripting. Suppose there are 4 tests and I want to call these tests in a main script. Is this possible in qtp?

869