FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Question about array
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Question about array
Posted: 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. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Question about array
Posted: Sun Apr 12, 2009 03:15 AM
Code (fw): Select all Collapse
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
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Question about array
Posted: Sun Apr 12, 2009 06: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. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Continue the discussion