Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Identifying arrays
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00436254
Message ID:
00436751
Views:
22
>>>>try TYPE("variable[1]").
>>>>This will return U unless vaiable is an array.
>>>
>>>Actually, it's a little more complicated that than. Note that TYPE('OBJECT.NAME[1]') returns 'C', not 'U'; that's true for all native properties of an object. The best way I've found is to test for element 0 as well, because while an array can't have an element 0, TYPE('OBJECT.NAME[0]') still returns 'C'. So, the following routine will return .T. if the specified property for the specified object is an array:
lparameters toObject, tcProperty
>>>return type('toObject.' + tcProperty + '[0]') = 'U' and ;
>>>  type('toObject.' + tcProperty + '[1]') <> 'U'
Doug
>>
>>Hi Doug,
>>
>>You might want to add this tip to FAQ section.
>
>Nick,
>
>Do you think it's better to create one FAQ for all IsArray or IsObjectPropertyArray functions? In this case we will see all necessary information in one place and it would be simpler to compare different methods for different purposes...
>
>Also Trey suggested another approach, which might be worth considering...

That would be nice, but this task is almost like writing a book called "1001 UT advices you always wanted to know but were afraid to ask" :)
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform