Question about array

Question about array

Postby driessen » Sun Apr 12, 2009 12:55 am

Hello,

How can I detect when a variable contains a single data or an array ?
In case it contains an array, how can I determine the dimension of this array ?

Thanks a lot for any help.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Question about array

Postby nageswaragunupudi » Sun Apr 12, 2009 3:15 am

Code: Select all  Expand view

if ValType( uVar ) == 'A'
   // array
   nRows  := Len( uVar )
   if nRows > 0
      if ValType( uVar[ 1 ] ) == 'A'
         // 2 dimentional array
         nCols  := Len( uVar[ 1 ] )
      endif
   endif
else
   // not an array
endif
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10624
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Question about array

Postby driessen » Sun Apr 12, 2009 6:45 pm

Hello G.,

Thank you very much for your help.

Happy Eastern to you and your family.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 62 guests