how to count spaces in a given string ex: "this is jagadeesh"
in QTP with simple functional script

Answers were Sorted based on User's Feedback



how to count spaces in a given string ex: "this is jagadeesh" in QTP with simple function..

Answer / jaag@jagadeesh

dim str
str="this is jagadeesh
var=UBound(split(str," ")))
msgbox var

ans
2

Is This Answer Correct ?    19 Yes 2 No

how to count spaces in a given string ex: "this is jagadeesh" in QTP with simple function..

Answer / karthik janahan

Dim str
str = "how to count spaces in a given string"
msgbox (len(replace(str," ","..")) - len(str))

Is This Answer Correct ?    9 Yes 2 No

how to count spaces in a given string ex: "this is jagadeesh" in QTP with simple function..

Answer / ekapop (scnyl)

Hi,
Const sMY_INFO = "this is jagadeesh"

Function GetTotalSpaceFromText(ByVal sText)
Dim iTotal
Dim asInfo

asInfo = Split(sText, " ")
iTotal = UBound(asInfo)

Erase asInfo
GetTotalSpaceFromText = iTotal
End Function

Msgbox "My Text = " & sMY_INFO & vbCrLf & _
"Total Space = " & GetTotalSpaceFromText(sMY_INFO)

Is This Answer Correct ?    5 Yes 2 No

how to count spaces in a given string ex: "this is jagadeesh" in QTP with simple function..

Answer / nitin kumar

str="this is jagadish"
k=split(str," ")
msgbox("spaces are "&ubound(k))

Is This Answer Correct ?    1 Yes 0 No

how to count spaces in a given string ex: "this is jagadeesh" in QTP with simple function..

Answer / nahush

txt = "this is jagadeesh"
no_of_space = len(txt)-len(replace(txt," ",""))


MsgBox no_of_space

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More QTP Interview Questions

in qtp how we work with out put values and what is the process?

4 Answers  


Error handling

3 Answers   Wipro,


What are the main differences of qtp and win runner?

0 Answers  


How to connect to data base?

2 Answers  


Which scripting language used by quicktest professional (qtp)?

0 Answers  


In qtp, how you can remove the spaces from string?

0 Answers  


can we enable smart identification for test object

3 Answers  


What is parameter in qtp?

0 Answers  


what is stepin & stepout?

0 Answers  


Can any suggest me what is exposure testing?

0 Answers   Value Labs,


Hi i want to export the data from applicatioon to excel and later i want to import and use it for my scripts hoe can i do this?

1 Answers  


What are the abbreviations for tsr and mtr?

17 Answers   Ordain Solutions, TSR,


Categories