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

Answers were Sorted based on User's Feedback



How can i count "spaces" in any sentence or a string if suppose " It is a Testing qu..

Answer / ravi

arrResult= split("It is a Testing question", " ")
msgbox "No. of Spaces " & ubound(arrResult)

Is This Answer Correct ?    18 Yes 1 No

How can i count "spaces" in any sentence or a string if suppose " It is a Testing qu..

Answer / sri

s="Gita is a good girl "
d=split(s," ")
count =0
For i=ubound(d) to 1 step -1
count =count +1

Next
msgbox count

Is This Answer Correct ?    11 Yes 4 No

How can i count "spaces" in any sentence or a string if suppose " It is a Testing qu..

Answer / 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

How can i count "spaces" in any sentence or a string if suppose " It is a Testing qu..

Answer / annie

a=inputbox("enter the string")
countspaces=len(a)-len(replace(a," ",""))
msgbox "count is" & countspaces

Is This Answer Correct ?    1 Yes 0 No

How can i count "spaces" in any sentence or a string if suppose " It is a Testing qu..

Answer / nitin sharma

dim mystring
mystring = "QTP world is a software engineer"
msgbox Len(mystring)-Len(Replace(mystring," ",""))
'it will give count of spaces

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More QTP Interview Questions

What is the need and applications of learning VB script for a automation(QTP) engineer ain Realtime ?

1 Answers  


How can you identify the browser and its information using the qtp script?

0 Answers  


Can we Test Welcome Screens and Process Images with QTP

0 Answers  


what is the use of automation frame work ??(QTP)

2 Answers  


What are the key elements available in test result window?

0 Answers  






How many types of OBJECTS are there in QTP?

8 Answers   Intel, Inter Globe Technologies,


hi Sudhananda reddy, in my resume, i written as , I Am working as a Test Engineer for xyz company. IS IT RIGHT OR WRONG? WHAT IS THE ACTUAL meaning of "IN XYZ COMPANY", "FOR XYZ COMPANY", "WITH XYZ COMPANY".

2 Answers  


Tel me what was the automation testing process you followed?

2 Answers  


Can we do qtp testing without creating objects in Dbject repository? can we do it completely writing code i.e in expert view only. Are there any books for this?

7 Answers   Accenture,


does QTP provides any tools for parametrisation?

4 Answers  


what is exact difference between smoke and sanity testing?

6 Answers   Satyam,


Using Regular expression method some particular value is not present in given value. HOow do use regular expression? Forexample password all number,character ,special character are accepted but (_',)underscore,comma are not used. How do write regular expression.

1 Answers  


Categories