LEN

Previous  Next

 

length = LEN( str   AS STRING ) AS INTEGER

upper  = LEN( array AS ARRAY,

             [index AS INTEGER] ) AS INTEGER

 


 

Returns the length of a string or the dimension count or upper bounds of an dimension of an array.  If the parameter is an array and the second parameter is omitted (or -1) then the dimension count is returned otherwise the upper bounds of specified element.  Dimension numbers are specified from right to left, rightmost dimension being 0 (or 1 in case of base 1)

 

Example:

 

PRINT "Length = "; LEN( "Kalle Anka"), ' Length = 9

 

DIM a( 3 , 4 ) AS REAL

 

' Return dimension count

PRINT "Array Dim = ";LEN( a ),

Array Dim = 2

 

' Return upper bounds of first dimension

PRINT "Array Dim = ";LEN( a, 0 ),

Array Dim = 4

 

' Return upper bounds of second dimension

PRINT "Array Dim = ";LEN( a, 1 ),

Array Dim = 3