i have an array CAPGEMINI .....Here i need to check whether
G is there or not ..how to do that
and friends i have one big doubt that is
whether it is array or string ,how we come to know that and
where we consider that it's array ,where we consider that
it's an string
because when i want to find the length i have big doubt
whether we need to use len function or ubound ...
ans me for this TWO Questions any one please

Answers were Sorted based on User's Feedback



i have an array CAPGEMINI .....Here i need to check whether G is there or not ..how to do that an..

Answer / udayakiran

This might be the solution If we consider it as array:

ar2 = Array("C","A","P","G","E","M","I","N","I")

arlen=UBound(ar2)-lbound(ar2)+1 'Finding array length

For p= 0 to arlen-1
If strcomp(ar2(p),"G")=0 Then
msgbox "The letter G is found"
Exit For
End If
Next

Is This Answer Correct ?    3 Yes 0 No

i have an array CAPGEMINI .....Here i need to check whether G is there or not ..how to do that an..

Answer / tarakeshwar

a="CAPGEMINI"
length = len(a)
flag ="G is not present"
For i = 1 to length
res= mid(a,i,1)
if res = "G" then
flag = "G is present"
End if
Next
msgbox flag

Is This Answer Correct ?    3 Yes 0 No

i have an array CAPGEMINI .....Here i need to check whether G is there or not ..how to do that an..

Answer / arun

Please try this

Dim AR2,i
AR2 = Array("C","A","P","G","E","M","I","N","I")

For i=0 to ubound(AR2)
If AR2(i)="G" Then
msgbox "G found in Array"
End If
Next

Is This Answer Correct ?    3 Yes 0 No

i have an array CAPGEMINI .....Here i need to check whether G is there or not ..how to do that an..

Answer / gabbar

Dim a
a=array("CAPGEMINI" )
If len(join(a))<>len(Replace(join(a),"G","")) Then
msgbox "Occurance of G in array: "&len(join(a))-len(Replace(join(a),"G",""))
End If

Is This Answer Correct ?    2 Yes 0 No

i have an array CAPGEMINI .....Here i need to check whether G is there or not ..how to do that an..

Answer / koteswar

str = "CAPGEMINI"
z= "G "
flag = 0
For i = 1 to len(str)
x = mid(str, i, 1)
If Instr(1,z,x,1) Then
msgbox z
If flag = 0 Then
Reporter.ReportEvent micPass, "The required Letter is
available in the stirng", "True"
else
Reporter.ReportEvent micFail , " The required Letter is
not availabe in the string" , "False"
End If
End IF
Next

Array means It is a collection of similar objects and
enclosed with curly braces. at that time you can use Ubound
for count the no of objects are available in the given array

Srring means single or collection alphanumeric characters
enclosed with quotations. If you want to count the no of
characters in the given string you can use len()

Is This Answer Correct ?    1 Yes 0 No

i have an array CAPGEMINI .....Here i need to check whether G is there or not ..how to do that an..

Answer / rajesh

see that is my question...here you also confused, here
CAPGEMINI is a array ,not a string..give a ans please

Is This Answer Correct ?    1 Yes 0 No

i have an array CAPGEMINI .....Here i need to check whether G is there or not ..how to do that an..

Answer / ganesh

ok koteshwar can u explain about flag = 0

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More QTP Interview Questions

What is smart identification in QTP?

0 Answers   HCL,


Hi All, I am 4 yrs experieced in manual testing and new to automation tool QTP. Iam trying to learn it thru online and material i have.I am able to understand but unable to trace out which method or function to be used where necessary in VB Script. How come we know the functions or methods to be used to open a window when clicking on button or so...Pls suggest me.How can i proceed further to apt VB Script.

0 Answers  


Is there any pdf or online book for QTP Scripting? Let me know more about QTP Scripting.

0 Answers  


How to associate shared object repository to test in qtp?

0 Answers  


Define Environment Variable in UFT and its uses?

0 Answers  






Suppose there is a bitmap with some text in it how do you write the script to get the text.

2 Answers   BirlaSoft,


How to handle "Java Runtime error" popup window in the web application ? Sometimes the application throws the error repeatedly... Is there any browser setting available to disable the error ?

2 Answers   TCS,


How to identify 2 versions of browsers based on regular expression

1 Answers   Cognizant,


Why use Regular Expressions?

1 Answers  


In a WebTable 2nd row,3rd column contains one link and that link name is changing dynamically. How you will click the link?

1 Answers   Bank Of America,


can we call a test in another test?

3 Answers   iFocus,


hai, i completed my b.tech in 2010 with 62.3%. i having knowledge on manual testing and Qtp. i want Relavent experience in testing.watever may be d salary i dont bother..I just want to gain knowledge. i dont have good communication skills.

0 Answers  


Categories