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

Do you know SQL? I know SQL but i don't have any experience...that's it..No more questions ...simply he said " you can leave for the day" ...guys prepare SQL Quires before attending interview in bank of america...

1315


How many ways is to parameterize the value?

615


what is the difference between the modular framework and datadriven frame work

1910


What are the things(properties, and other details) will be recorded while recording an object using normal recording?

1491


What the differences are and best practical application of Object Repository?

586






How to use userdifined environment variables.Once we created in Environment tab which is at File--> Settings-- >Environment-->Userdifined

1465


how to know no.of mails in our g mail by using vb-script

1779


What is the use of sendkeys and what are send keys

1952


Explain the types of object repositorys in qtp?

575


Can we Test Welcome Screens and Process Images with QTP

1427


How do you do batch testing in wr and is it possible to do in qtp, if so explain?

506


How software tester can use constants and variables in scripts?

1686


In QA Testing when do you use Loadrunner vs QTP? What are the main differences between those two tools? Explain the purpose with real world scenario examples...In advance thank you!!!

2385


Hi All, I Want To excute scripts batch without using QC .I need code for that Thanks Balaji

1324


I want two test two agents login for the flight website. Here is the scenario: I want to go through 1-3 rows for one user login and other user login I want to go though 3-5 rows. How would you set this up in qtp. Thank You

1520