Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP6 Tip-o-the-day
Message
From
15/07/1998 14:45:51
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00117727
Message ID:
00117747
Views:
22
>Folks,
>
>Remember the hassles wehn you forgot the quotes when using the TYPE() fucntion. Well, you can forget them in VFP6 and use the VARTYPE() function instead. The following code shows both the TYPE() and VARTYPE() functions doing the same thing;
>
>
>MyVar = "ABC"
>
>? TYPE("MyVar") && displays C
>? VARTYPE(MyVar) && displasy C
>
>Var1 = "ABC"
>Var2 = "DEF"
>
>?Type("Var1+Var2") && displays C
>? VarType(var1+var2) && displays C
>
>
>
>The help file even says that VarType() is faster than Type(). Since Type() is one of the most time consumming of the VFP functions, it is nice to have faster alternative.
>
>There are still some situations where you will need to use the Type() function. If you have a memory variable that contains the name of something else whose data type you want to know, you must use the Type() function. For example;
>
>
>Var1 = 123
>Var2 = "Var1"
>
>? TYPE(Var2) && Displays N because Var1 is numeric
>? VarType(Var2) && displays C because Var2 is character
>
>
Great tip, Jim! I use TYPE() all over the place to test object instances and will definitely have to look into this.
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05
Previous
Reply
Map
View

Click here to load this message in the networking platform