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

I have the script like this: Browser("Login").Page ("Application").Frame("ScopeFrame").Link("DC3701737 (Active)").Click in which the value "DC3701737" will get changed and i have to use the same value in so many places. I got the value "DC3701737" in to a variable(Say x). Now if i want to pass the variable in to link object .. how? Browser("Login").Page("Application").Frame ("ScopeFrame").Link(x).Click Is it possible to pass any variable into a link object .. so, that the application will select that link automatically? If ur not able to understand, pls let me know.

2 Answers   ABC,


i can done the project with QTP in that time i can say how many members in my team size?

0 Answers  


For which type of project the iterative model is suitable?

0 Answers  


In the application that I'm testing is having a WYSIWIYG editor.QTP is recording editor's body as web element. I want to add some data to this web Element at run time. The problem is that I cant find a method to add contents to this web Element. Can any one come up with an answer for this. Thankx.

0 Answers  


What is the difference between Accessibility Checkpoint and Bitmap Checkpoint in QTP? Note: I have read it in QTP help but i dont want answer from that.......

1 Answers  






what is the difference between DATA TABLE and DATA SET?

2 Answers   Accenture,


In QTP, If you have list of checkboxes, how can i select a particular checkbox and delete if the checkboxes are changing dynamically?

0 Answers  


What is environment variable in qtp and why to use it?

0 Answers  


hi everyone today is the first time i saw this website,and hi iam siraj,iam very impressed by seeing evryones response towards questions,iam a newcomer and i have got tryining in testing can anyone please send me some projects relaited to testing.i know it is very confidential but still if u send it will a great help. my mail id venku_krs@yahoo.co.in

1 Answers  


What kind of performance is expected on the client side (e.g., how fast should pages appear, how fast should animations, applets, etc. load and run)?

0 Answers  


how to change the properties of object during run time . plz give the code using flight reservation

2 Answers  


how to idetfy which test cases are automated?who will deside that plz tell me

0 Answers  


Categories