Micro Focus QTP (UFT) Forums
How to find Array Length in QTP? - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: How to find Array Length in QTP? (/Thread-How-to-find-Array-Length-in-QTP)



How to find Array Length in QTP? - bhanu_bp7 - 07-22-2008

How to find the length\size of an Array in QTP?

LineText="abcd efgh ijklm opqrst uvwx yz"
MyArray= split(LineText," ",-1,1)

Length ??????

Please help me


RE: How to find Array Length in QTP? - stevol - 07-22-2008

UBound(MyArray) returns the position of last array element, that is 5 in your example


RE: How to find Array Length in QTP? - koshlu - 07-23-2008

length_of_array = UBound +1 = 5+1= 6


RE: How to find Array Length in QTP? - blavanya - 07-25-2008

You store all the variables in temp variabl
var1=Len(MyArray(0))
var2=Len(MyArray(1))
var3=Len(MyArray(2))
var4=Len(MyArray(3))
var5=Len(MyArray(4))
var6=Len(MyArray(5))

TotalVar=var1+var2+var3+var4+var5+var6
TotalArraySize = TotalVar

This is the pretty easier basic code to get the array value