Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
IsNumeric - VFP analogue?
Message
From
24/12/1999 19:36:02
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00307922
Message ID:
00308473
Views:
47
>
>It just seems to me that the documentation indicates that it (the parameter) must be a character string: "The expression must be passed as a character string." Passing a variable without the quotes is not passing a character regardless of the variable's contents.

It depends what you want to evaluate (note that the same goes for Eval() and Type()). Whatever you pass to these functions must be a string (literal, variable, field, property, expression, function call). This string gets evaluated and its value or type of the value is returned.

Look at this:
lcX='Whatever'
lcY='lcX'
?type('lcx')="C"
?type(lcY)="C"

Both lcY and 'lcX' contain the same string, i.e. 'lcX', right? If we used Eval() instead of Type(), we'd be getting 'Whatever' both times.

>What I think is happening here is that because the variable happens to be character (when containing just numbers) evaluates properly. However, when containing just letters it does not.
>
>If I were to describe this, I wouldn't call it a bug, but I would call it a "feature". Under the circumstances, I still hestiate to rely on this in the future.

It's a feature, and a very good one. I'm using it for years, and trust me, I know what I'm doing. Imagine you had a string variable which contained a name of another variable - and you needed to know the value or type of that contained variable. Simply feed the name of the containing variable to these functions, and you got it. Look at this example:

Lparam lpObj

local lcVarName
lcVarName='lpObj.value'
?type(lcVarName)

You could probably get something better with vartype(lpObj.value), but I'm not sure whether it would behave if there was no .value property in lpObj.

And, btw, have a good, dark one :)

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform